
Deploying applications and application instances
17
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
instanceName
value in the
NetConnection.connect
command defines, as the following example shows:
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
room_01
creates are distinct from those that
room_02
creates, and the
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();
Содержание FLASH MEDIA SERVER 2-DEVELOPING MEDIA
Страница 1: ...Developing Media Applications ...
Страница 6: ...6 ...
Страница 10: ...10 About This Manual ...
Страница 36: ...36 Flash Media Server Architecture ...
Страница 80: ...80 Debugging and Monitoring Applications ...
Страница 106: ...106 Application Development Tips and Tricks ...
Страница 114: ...114 ...