sendObject()
Availability:
SmartFoxServer Lite / Basic / Pro
Usage:
smartFox.sendObject(obj <proplist>, roomId <integer>)
Description:
Sends a propertyList to the other users in the room.
Can be usefull 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. It can contain other propertylists, lists etc... | |
roomId | (optional) the Id of the target room. By default SmartFoxServer uses
the id of the current room. You may want to use this extra parameters if you're sending the object in a room that is different from the one you're currently in |
Returns:
Fires the onObjectReceived event
Example:
Example #1
A simple propertylist is sent to the other clients.
move = [#x:150, #y:250, #speed:8] smartFox.sendObject(move)
Example #2
A propertylist with two lists of items is being sent to the other clients.
itemsFound = [#jewels: ["necklace", "ring"], #weapons: ["sword", "sledgehammer"]] smartFox.sendObject(itemsFound)
See also:
onObjectReceived