[Red5] Wrapping my brain around SharedObjects
jojo at struktur.de
Fri Jun 9 17:05:51 EDT 2006
Leif Wells wrote:
> (I am starting to believe that I am becoming a one-man FAQ creator...)
> I believe that I understand understand how SharedObjects work with the
> Flash Media Server: You create an .asc file on the server that gets
> created inside your main.asc file.
> For example, on the server I have a file called peopleList.asc and
> inside that file I have methods that get called by the client -- and the
> shared object gets created by calling:
> peopleListSO = SharedObject.get ("peopleList", false);
> On the client side you'd call a method on the peopleList shared object
> by calling:
> nc.call("method_name", null, args);
This would call the method on the application, not on the SO. To invoke
a method on the SO, you would call plSO.send("method_name", null, args);
> With Red5, we create a Shared Object inside the Application.java with
> this code:
> createSharedObject(room, "peopleList", false);
> ISharedObject peopleList = getSharedObject(room, "peopleList");
> Now, this is what I am not getting my head around: Do I have a Java file
> that is PeopleList.java? Can I place methods inside there that will
> automatically get called when I make a similar nc.call() method on the
> client side?
If you want to invoke methods in the NetConnection, they need to be
implemented in the application. For methods in the SO, you only need
to write Java code if you want to handle the calls in your application.
> Or am I suppose to control *everything* from inside the the
> Application.java file and just tuck variables inside my shared objects?
> I guess the reason that I am asking is because there are no examples of
> this inside the project. I'd love to put together a sample (if there
> isn't one already created) so that others can follow by example. And
> seriously, I know the members of this team probably don't have a lot of
> time to do a ton of tutorials or sample files for Java dunces like me.
To catch method calls to the SO on the server, you will have to register
an ISharedObjectListener on it. This is described at
More information about the Red5