khoi
khoi5d ago

RealtimeDictionary.Count Accuracy

Is the .Count always accurate? What does this mean in the docs: "Adding or removing items sends the minimal amount of information to the server in order to perform the update on all clients. The whole collection is not sent every time."
2 Replies
kapa.ai
kapa.ai5d ago
Hi @khoi. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave: ---------------------- Yes, the .Count property of RealtimeDictionary is always accurate for the local state of the collection. When you add or remove items, the change is reflected instantly in your local RealtimeDictionary, and .Count will update accordingly. If the server later rejects the change (for example, due to ownership issues), the change will be rolled back and .Count will update again to reflect the true state. The statement in the docs—"Adding or removing items sends the minimal amount of information to the server in order to perform the update on all clients. The whole collection is not sent every time."—means that when you modify the collection, only the specific change (such as the addition or removal of a single item) is sent over the network, not the entire contents of the dictionary. This makes synchronization more efficient, especially for large collections, as only the delta (the change) is transmitted, not the full data set each time an update occurs. This approach helps reduce bandwidth and latency for all clients connected to the room RealtimeDictionary<TValue>. So, in summary: .Count is accurate for the current local state, and the efficient delta-based synchronization ensures that all clients stay up to date without unnecessary data transfer. ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ----------------------
kapa.ai
kapa.ai5d ago
<@412870643533479936> Kapa.ai is still learning and improving, please let me know how I did by reacting below.

Did you find this page helpful?