| Key points: |
- The two screens above are two independent instances of the same SimpleTextChat application. (They are as independent as if they were being run on two different computers, miles apart).
- In the establishConnection() method, each instance:
- gets a reference to THE SAME remote SharedObject (and assigns it to the SimpleTextChat application's global variable 'so'), and
- registers handleSync() to listen for SYNC events from 'so'.
- When any ONE application's instance's sendIM() method calls so.setProperty(), 'so' sends a SYNC event to the handleSync() method of EVERY running instance ofthe SimpleTextChat application.
- EVERY instance then updates its chatMessages TextArea component to show the new chat message.
- For each Messaging application you deploy into a given installation of WebORB, you MUST create a directory with the same name as the application in that installation of WebORB's /Application directory.
- For example, the installation of WebORB that's running this online sample is installed at IIS virtual directory http://examples.themidnightcoders.com, which IIS maps to the file system directory [confidential]/WebORB4 on our web server.
- So, to make this sample work online, I had to add a directory named SimpleTextChat to [confidential]/WebORB4/Applications.
- This directory is EMPTY. However, this sample is trivial. A non-trivial messaing application (NonTrivialApp) would require the use of an app.config file (in [confidential]/WebORB4/Applications/NonTrivialApp/app.config).
- The application method onCreationComplete() (main.mxml, lines 26-41) ensures that WebORB's Messaging server is up and running. If no fault occurs, then establishConnection() (main.mxml, lines 45-67) is called.
- main.mxml's line 52 is: var uri:String = ServerConfig.getChannel( "weborb-rtmp" ).endpoint. It returns (and assigns to uri) the path to the WebORB installation's Applications directory.
- main.mxml's line 53 is: nc.connect( uri + "/SimpleTextChat" ). The result of appending "/SimpleTextChat" to uri is the path to SimpleTextChat's directory in the Applications directory.
|