About Application Instances - MACROMEDIA FLASH MEDIA SERVER 2-DEVELOPING MEDIA Develop Manual

Developing media applications
Table of Contents

Advertisement

About application instances

Applications are run by creating application instances. When a client connects to an
application, the client is actually connected to an application instance. For example, a client
connects to an application named chat_app, as the following example shows:
nc.connect("rtmp://myDomain.com/chat_app");
In this example, the client is actually connected to the default instance of the application,
named _defInst_, because no instance is specified.
Clients can also connect to specific application instances that the
value in the
instanceName
command defines, as the following example shows:
NetConnection.connect
nc.connect("rtmp://myDomain.com/chat_app/instance1");
In this example, the client is connected to the application instance named
.
instance1
You might want to use application instances for specific purposes. For example, you may want
to give different groups of people access to the same application without having the groups
interact with each other, such as in a chat application with "rooms" for different topics. To do
this, you can have multiple instances of the chat application at the same time, as follows:
my_nc.connect("rtmp://myServer.myDomain.com/chatApp/room_01")
my_nc.connect("rtmp://myServer.myDomain.com/chatApp/room_02")
Each application instance is uniquely named. Unlike the parent application, an instance does
not require that its own directory be defined on the server. However, application resources,
such as streams and shared objects, are independent for each instance and are stored in their
own directories under the streams and sharedObjects storage directories configured for the
application.
Another reason to use application instances is to avoid collision of recorded streams or shared
objects that are created by the application. In the preceding example, for instance, any streams
or shared objects that
creates are distinct from those that
creates, and the
room_01
room_02
reverse, even though both instances are running the same application, chat_App.
For example, although the support application in the following code creates two shared
objects named CustomerInfo, each instance of the support application has access only to its
own CustomerInfo object. Also, the data in CustomerInfo used by session1 is different from
the data in CustomerInfo used by session2, as the following example shows:
// One instance of application "support"
first_nc = new NetConnection();
first_nc.connect("myserver.mydomain.com/support/session1");
first_so = SharedObject.getRemote("CustomerInfo", first_nc.URI, false);
first_so.connect(first_nc.URI);
// Another instance of application "support"
second_nc = new NetConnection();
Deploying applications and application instances
17

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the FLASH MEDIA SERVER 2-DEVELOPING MEDIA and is the answer not in the manual?

This manual is also suitable for:

Flash media server 2

Table of Contents