Availability:
SmartFoxServer Basic / Pro
Usage:
smartFox.setNetMessageHandler(serverEventHandler <symbol>, myEventHandler <symbol>, myApplication <instance>)
Description:
Re-route a specific server event message to your object so that you can handle it.
See a complete list of Handlers for Events in the menu to the left.
Parameters:
serverEventHandler | the name of the server event you want to handle | |
myEventHandler | the name of the event in your object | |
myapplication | the object that will handle the event |
Returns:
Nothing.
Example:
Create a parent script for your multiuser application, that will handle server events.
property pSmartFoxClient on new me pSmartFoxClient=script("oSmartFoxClient").new() -- set my event handlers please pSmartFoxClient.setNetMessageHandler(#onConnection, #onConnection, me) pSmartFoxClient.setNetMessageHandler(#onLogin, #onLogin, me) return me end -- my event handlers that are auto-set! on onConnection me, status if tStatus then put "onConnection: Connection established" else put "onConnection: Connection failed" end on onLogin me, results if results[#success] then put "onLogin: Logged in with name:" & results[#name] else put "onLogin: Failed to login with error:" & results[#error] end
See also:
autoSetNetMessageHandlers()