[Red5] Problems with SharedObject.

Julian Palacios julian at otila.com
Fri Jul 6 15:12:55 EDT 2007


This is an example of what i'm using.
It works fine the first time i log in to the client.
But when I close it and I log back in, the saredobject shows empty and 
new attributes cannot be added.

Does someone know why could this be happening?




public class Application extends ApplicationAdapter implements 
IPendingServiceCallback, IStreamAwareScopeHandler {
    
    private ISharedObject so;

    public boolean appStart(IScope scope) {        
        createSharedObject(scope, "users_so", false);
        so = getSharedObject(scope, "users_so");
       
        return true;
    }

    public boolean appConnect(IConnection conn, Object[] params) {
        username = params[0].toString();
        service.getClient().setAttribute("username", username);

        return connected;
    }

    public boolean appJoin(IClient client, IScope scope) {
        String username = (String) client.getAttribute("username");
       
        so.setAttribute(username, "0");
        return true;
    }

    public void appLeave(IClient client, IScope scope) {
        String username = (String) client.getAttribute("username");
       
        so.removeAttribute(username);
    }

    public void streamPublishStart(IBroadcastStream stream) {
        String username = stream.getPublishedName();

        so.setAttribute(username, "1");
    }


    public void streamBroadcastClose(IBroadcastStream stream) {
        String username = stream.getPublishedName();

        so.setAttribute(username, "0");
    }
}



More information about the Red5 mailing list