User Guide
44 Using Media Classes
Also, if you want to use the call() method on the Client object that is connecting, make sure
you call
application.acceptConnection() and know that the client is connected before
issuing any additional commands. The following code sets up this sequence of actions:
application.onConnect = function(clientObj,name,passwd)
{
// First accept the connection
application.acceptConnection(clientObj);
// After client is registered with the application instance
// you can use "call" method
clientObj.call("onWelcome", "You are now connected!!!");
return;
// After you call acceptConnection() or
// rejectConnection() within onConnect, return value is ignored.
}
TIP
If you’re using components, see “Handling events in a component-based application”
on page 46.