Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.5k views
in Technique[技术] by (71.8m points)

firebase - recent messages with firestore - 1 second document write limit - swift

I would like to implement a feature in my iOS application similar to the whatsapp application, when you're in the chat view controller you can see all the users you last contacted with affiliated the last message in the chat.

In order to do that I thought about creating a collection called something like "LastMessages" structured in this way:

/LastMessages/userID/LastMessagesSubCollection/user1ID

and in this last user1ID document I store the last message present in the chat. Whenever a user sends a message I overwrite this document with the last message the users have sent.

So considering that Firestore has a Maximum sustained write rate to a document of 1 per second: Is this the wrong approach to solve this problem? If both users send 2 messages at the same exact moment there may be some problem in the document write? What may be a better approach to solve the same problem?

question from:https://stackoverflow.com/questions/65848599/recent-messages-with-firestore-1-second-document-write-limit-swift

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

2.1m questions

2.1m answers

60 comments

57.0k users

...