autoSetNetMessageHandlers()

Availability:

SmartFoxServer Basic / Pro

Usage:

smartFox.autoSetNetMessageHandlers(myapplication <instance>)

Description:

This is a lazy way to reroute all events from the server to your object with any corresponding handler names. It is an alternative to setting each netMessageHandler individually.

Parameters:

myapplication     the object you want all events to be passed to

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()
	-- auto-set my event handlers please
 	pSmartFoxClient.autoSetNetMessageHandlers(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: