Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

Synchronization & message passing & room

Avatar

Level 1

Hey,

I'm playing with the concept of a real time collaborative text editor, using CoCoMo as the backend.

I've based my example app on the ComplexObjectTransfer and add diff-objects to the collection node.

Am operating under the assumption that ComplexObjectTransfer is using Message Passing and that it should be the best approach to this.

Are messages sent like this guaranteed to arrive to all clients, or is it more UDP-y?

Is that even close to a valid assumption?

Further on, to somehow get several clients to end up with the same copy of the text I'm planning to send along a psuedo timestamp.

Might query a server a couple of times and average out the times to get a somewhat valid pseudo timestamp.

Is there any internal timestamp that would suit me better?

Does CoCoMo offer any fancy way of 'syncing in' a new user? My current solution is to ask a random user for the complete text, with a timestamp, and just joining in at that point, adding all the diff-objects it receives from the timestamp and forward.

At some point I'd like to do this as a pastebin, is there a way to create new rooms on the fly with backend code?

Any limitations on the number of rooms? Could I store the last edited version of the text in the room itself, letting it be persisted by that?

Sorry if I haven't read the docs good enough. If anyone has a better approach to what I'm trying to do just slap me with it (:

Cheers,

Erik

3 Replies

Avatar

Level 10

Hi,

I will try to answer some of your questions.

>> Am operating under the assumption that ComplexObjectTransfer is using Message Passing and that it should be the best approach to this.

ComplexObjectTransfer is one example that shows how you can pass complex objects( not just simple strings/numbers) as messages   in AFCS using collectionnodes and nodes.

Messages will be received by every user who is in the room. Every collection Node has an ItemReceive event and you will receive all the messages passed on this collectionnode in itemReceive event handler. Another simple example that provides how you can use and create collection node and receive nodes is the SharedModel example in example folder.

>>Might query a server a couple of times and average out the times to get a somewhat valid pseudo timestamp

>>Is there any internal timestamp that would suit me better?

Every message item that you send has a timestamp property that is the time this message was broadcast and written on the server. For more read the docs of MessageItem class under com.adobe.rtc.messaging

>>Does CoCoMo offer any fancy way of 'syncing in' a new user?

Whenever a new user comes into a room, he syncs up with every collectionNode in that room that he has subscribed to. When a new user comes into a room. he receives all the items for that collectionNode ( as discussed in ItemReceive event above) and then when he has received all items , he gets a synchronizationChange event on that collectionNode. You can add a synchronizationChange event handler( the shared model example shows that) and when it is synchronized , the collection.issynchronized property is true. Most of the time we draw our UI after we have synced all the messages so that your application is in the current state of the room.

>> is there a way to create new rooms on the fly with backend code?

yes , you can create room programmatically using external authentication.

>>Any limitations on the number of rooms?

Currently the free beta version has limit of 25 rooms I think.

>>Could I store the last edited version of the text in the room itself, letting it be persisted by that?

You can store any messageItem in a node if you set the persistItems property and the sessionDependantItems property to true in the NodeConfiguration. PersistItems set to true stores it temporarily as the meeting session is on. It is by default true only. However, if you want to keep the message item even after you session ends so that you can retrive it next time you start the session, you need to set sessionDependantItems to true( it defaults to false). For deatils, refer to the docs of NodeConfiguration class in com.adobe.rtc.messaging

When you create any node, it requires a NodeConfiguration. If you don't pass , it will take the default  NodeConfiguration. So, you can change it as per your requirements.

You can change the NodeConfiguration values of any node through dev console also using Devconsole UI.

Hope this all helps.

Thanks

Hironmay Basu

Avatar

Level 1

Perfect mate. Thanks a ton. (Yer quick too!)

Avatar

Employee

A couple of corrections and clarifications:

>>> is there a way to create new rooms on the fly with backend code?

>yes , you can create room programmatically using external authentication.

We provide server-side scripts in a few languages for back-end operations. Managing external authentication is one the tasks you can do server-side. Other tasks are room creations / deletion / listing, etc.

Look in the extra/scripts folder in your SDK install

>>>Any limitations on the number of rooms?

>Currently the free beta version has limit of 25 rooms I think.

There is no real limitation on the number of rooms you can create (but a very high number of room is going to be hard to manage).

Free beta accounts have a limit of 25 total users per account, so you can only have a maximum of 25 active rooms at any given time.