Using Communication Objects > Application object > Application.onDisconnect |
![]() ![]() ![]() |
Application.onDisconnect
The server calls the application.onDisconnect
method when a client disconnects from the application. You might add code to this handler that notifies all other clients about this event:
// On the server side you would have the following application.onConnect = function(newClient, name) { newClient.name = name; return true; } application.onDisconnect = function(client) { for (var i = 0; i < application.clients.length; i++) { application.clients[i].call("userDisconnects", client,name); } } // On the client side you would have the following nc = new NetConnection(); nc.userDisconnects= function (name) { trace(name + "quits"); } nc.connect ("rtmp:/app_name", userName);
Tip: If you're using components, see Application.onConnectAccept and application.onConnectReject.
![]() ![]() ![]() |