sendObjectToGroup()

Availability:

SmartFoxServer Lite / Basic / Pro

Usage:

smartFox.sendObjectToGroup(obj <propList>, userList <list>, roomId <integer>)

Description:

Sends an propertyList to one or more users, as specified in the second parameter
Can be useful for sending complex/nested data structures to clients, like a game move or a game status change.

Supported datatypes are: Strings, integers, lists, proplists, rectangles, points and rgb

Parameters:

obj   A propertyList containing all data that you need to send. The Object can contain other objects, arrays etc...
userList   A list containing one or more recipient id
roomId   (optional) the id of the source room, if you are allowing users to join multiple rooms

Returns:

Fires the onObjectReceived event

Example:

A propertylist with data is sent to the users with id = 1,2

move = [#x:150, #y:250, #speed:8]

smartFox.sendObjectToGroup(move, [1, 2])

 

See also:

onObjectReceived