Friends of the Wowza team
we are having trouble persists SharedObjects, we are using the code below, but to persist the object, exit the application, and after application complete with stop app, and return access the SharedObject is not triggered on the client to run.
It seems that everything is lost when you turn INFO server comment - onAppStop.
The file is created successfully within applications / myapp / SharedObjects / my_shared_object.rso
Any idea?
server-side:
public void changeConfigurations(IClient client, RequestFunction function, AMFDataList params) {
getLogger().info("configurationsSO: "+params);
ISharedObjects sharedObjects = client.getAppInstance().getSharedObjects(true); // SET TRUE FOR PERSISTENT
ISharedObject sharedObject = sharedObjects.getOrCreate(“configurationsSO”); // CREATE OR GET Sharedobject
sharedObject.lock();
try
{
sharedObject.acquire();
sharedObject.setProperty(params.getObject(PARAM1).getString(“type”), params.getObject(PARAM1).getBoolean(“action”));
}
catch (Exception e)
{
getLogger().info("Error attaching "+e.toString());
}
finally
{
sharedObject.unlock();
}
}
client-side
configurationsSO = SharedObject.getRemote(“configurationsSO”, modelControl.ncManager.uri, true);
modelControl.configurationsSO.addEventListener( SyncEvent.SYNC, syncConfigurations) ;
modelControl.configurationsSO.connect( modelControl.ncManager );
modelControl.configurationsSO.client = this;
private function syncConfigurations(event:SyncEvent):void
{
var resultInteracts:Object = event.target.data;
for( var currentChangeList:String in event.changeList )
{
var change:Boolean = (event.changeList[currentChangeList].code == “change”);
var success:Boolean = (event.changeList[currentChangeList].code == “success”);
var clear:Boolean = (event.changeList[currentChangeList].code == “clear”);
var deletes:Boolean = (event.changeList[currentChangeList].code == “delete”);
if(change){ trace(“change:”) }
if(clear){ trace(“clear:”) }
}
}