This past week our team was playing around with integrating Remote Shared Objects (RSO) and WebORB. An RSO is an object that lives on the server. It resides in the scope of a messaging application clients connect to. More than one client can connect to an RSO and all of them will access to the data in the RSO. We used WebORB for managing the RSO and providing access to the RSO for various clients. We came up with a small online version of the “Add a word” game that uses RSOs to build a sentence as well as manage user turns. The object of this game is to add a word to a sentence, one user at a time, and eventually come up with a very long sentence (that still makes sense). Consider the following example:
- Two connected users begin a game of “Add a word”.
- The application assigns turns to each of the connected users.
- User 1 starts the game by typing “My”. Once User 1 submits a word, it is the next user’s turn. The application automatically disables the submit button for the first user, and enables it for the next user.
- User 2 types “house” and clicks Submit, passing control back to User 1 User 1 types “is”, and so on.
- During the game, the RSO keeps track of the content of the sentence. At this point it will read “My house is”.
You should note that there’s no need for a server-side code to create this simple application, especially if you just want to add words to a sentence stored in the RSO. We just added a bit of complexity to the programming to showcase that either the clients (ActionScripts) and/or the server (.NET C#) can access and modify the RSO. This simple example demonstrates how to use Remote Shared Objects and WebORB together.