Question
Synchronizing Shared Objects
// Server side
application.onAppStart = function()
{
// ... code here
application.users_so = SharedObject.get("users_so", false);
// ... more code here
}
application.onConnect = function(newClient, userID)
{
// client object properties being setup, etc
application.users_so.setProperty(userID, newClient);
// ... more code
application.acceptConnection(newClient);
}
// Client side
nc.connect(rtmpURL, userID);
users_so = SharedObject.getRemote("users_so", nc.uri, false);
users_so.connect(nc);
When I call the above on the client side I should receive a copy of all users that are stored in the server's shared object indexable by users_so.data[userID] correct?
on the server side I perform the following:
application.acceptConnection(newClient);
newClient.call("updateStatus", null, userID);
on the client side the updateStatus method looks like this:
nc.syncQuestions = function(userID:String)
{
trace("--> "+users_so.data[userID]+" <--");
}; (is the ';' necessary?!?)
this prints: --> undefined <--
WHY?!? 😞 --> is this because of a race condition between the nc.connect() and the users_so.connect() ??
NOTE: My problem seems to arise when I try to re-connect (i.e. connect w/ client, close client, re-open client)
Cheers
application.onAppStart = function()
{
// ... code here
application.users_so = SharedObject.get("users_so", false);
// ... more code here
}
application.onConnect = function(newClient, userID)
{
// client object properties being setup, etc
application.users_so.setProperty(userID, newClient);
// ... more code
application.acceptConnection(newClient);
}
// Client side
nc.connect(rtmpURL, userID);
users_so = SharedObject.getRemote("users_so", nc.uri, false);
users_so.connect(nc);
When I call the above on the client side I should receive a copy of all users that are stored in the server's shared object indexable by users_so.data[userID] correct?
on the server side I perform the following:
application.acceptConnection(newClient);
newClient.call("updateStatus", null, userID);
on the client side the updateStatus method looks like this:
nc.syncQuestions = function(userID:String)
{
trace("--> "+users_so.data[userID]+" <--");
}; (is the ';' necessary?!?)
this prints: --> undefined <--
WHY?!? 😞 --> is this because of a race condition between the nc.connect() and the users_so.connect() ??
NOTE: My problem seems to arise when I try to re-connect (i.e. connect w/ client, close client, re-open client)
Cheers
