I've got just one short question: is there some kind of event to check whether the subscription to a SharedProperty or SharedCollection is complete?
Kind regards,
Hans
Solved! Go to Solution.
Views
Replies
Total Likes
Hi,
Once you call subscribe, you need to wait till the synchronization is complete, else it will say you aren't subscribed yet and throw errors. Add the handler to synchronizationChange event of SharedCollection, and when you come into the handler and it's synchronized, you can add any local values to it.
First the SharedCollection has to be synchronized with server before adding value, which kicks out once you call sharedCollection.subscribe(). There are many examples displaying this.
Hope this helps.
Thanks
Hironmay Basu
Views
Replies
Total Likes
Hi,
What do you mean by subscription to SharedProperty or SharedCollection. If you haven't subscribed to any of those, you won't receive any item or events on them and they won't be synchronized. You can use isSynchronized to check that.
Thanks
Hironmay Basu
Hi,
I want to put some initial values in a SharedCollection. I thought doing this by letting the first connected user fill a local array with the values, and then copying them to the SharedCollection. When I put this function straight after the initialization and subscription to the SharedCollection, I get null exceptions or errors saying that I am not subscribed to the SharedCollection (probably because the subscription is asynchronous). Therefor I thought of triggering the function that copies the local values to the SharedCollection by some kind of 'SubscriptionComplete' event or something, saying that the SharedCollection is connected.
Probably I can use the isSynchronized property to accomplish such a thing.
Thanks,
Hans
Views
Replies
Total Likes
Hi Hans,
synchronizationChange should get dispatched once the property is done subscribing.
hope that helps
nigel
Views
Replies
Total Likes
Hi,
Once you call subscribe, you need to wait till the synchronization is complete, else it will say you aren't subscribed yet and throw errors. Add the handler to synchronizationChange event of SharedCollection, and when you come into the handler and it's synchronized, you can add any local values to it.
First the SharedCollection has to be synchronized with server before adding value, which kicks out once you call sharedCollection.subscribe(). There are many examples displaying this.
Hope this helps.
Thanks
Hironmay Basu
Views
Replies
Total Likes