# < INFSmartFoxISFSEvents > Protocol Reference

List of all members.

## Public Member Functions
(void) | - onAdminMessage:
(void) | - onBuddyList:
(void) | - onBuddyListError:
(void) | - onBuddyListUpdate:
(void) | - onBuddyPermissionRequest:
(void) | - onBuddyRoom:
(void) | - onConfigLoadFailure:
(void) | - onConfigLoadSuccess:
(void) | - onConnection:
(void) | - onConnectionLost:
(void) | - onCreateRoomError:
(void) | - onDebugMessage:
(void) | - onExtensionResponse:
(void) | - onJoinRoom:
(void) | - onJoinRoomError:
(void) | - onLogin:
(void) | - onLogout:
(void) | - onModMessage:
(void) | - onObjectReceived:
(void) | - onPrivateMessage:
(void) | - onPublicMessage:
(void) | - onRandomKey:
(void) | - onRoomAdded:
(void) | - onRoomDeleted:
(void) | - onRoomLeft:
(void) | - onRoomListUpdate:
(void) | - onRoomVariablesUpdate:
(void) | - onRoundTripResponse:
(void) | - onSpectatorSwitched:
(void) | - onUserCountChange:
(void) | - onUserEnterRoom:
(void) | - onUserLeaveRoom:
(void) | - onUserVariablesUpdate:

## Member Function Documentation

- (void) onAdminMessage: |  | (INFSmartFoxSFSEvent *) | evt |  | `[optional]`

Dispatched when a message from the Administrator is received. Admin messages are special messages that can be sent by an Administrator to a user or group of users. All client applications should handle this event, or users won't be be able to receive important admin notifications!

The params object contains the following parameters.

Parameters:

  | message | : (String) the Administrator's message.

See also:
  - onModMessage:

Version:
  SmartFoxServer Basic / Pro

- (void) onBuddyList: |  | (INFSmartFoxSFSEvent *) | evt |  | `[optional]`

Dispatched when the buddy list for the current user is received or a buddy is added/removed.

The params object contains the following parameters.

Parameters:

  | list | : (Array) the buddy list. Refer to the buddyList (INFSmartFoxiPhoneClient) property for a description of the buddy object's properties.

See also:
  - onBuddyListError:

  - onBuddyListUpdate:

  - onBuddyRoom:

  INFSmartFoxiPhoneClient::_buddyList

  - loadBuddyList (INFSmartFoxiPhoneClient)

  - addBuddy: (INFSmartFoxiPhoneClient)

  - removeBuddy: (INFSmartFoxiPhoneClient)

Version:
  SmartFoxServer Basic / Pro

- (void) onBuddyListError: |  | (INFSmartFoxSFSEvent *) | evt |  | `[optional]`

Dispatched when an error occurs while loading the buddy list.

The params object contains the following parameters.

Parameters:

  | error | : (String) the error message.

See also:
  - onBuddyList:

Version:
  SmartFoxServer Basic / Pro

- (void) onBuddyListUpdate: |  | (INFSmartFoxSFSEvent *) | evt |  | `[optional]`

Dispatched when the status or variables of a buddy in the buddy list change.

The params object contains the following parameters.

Parameters:

  | buddy | : (Object) an object representing the buddy whose status or Buddy Variables have changed. Refer to the buddyList (INFSmartFoxiPhoneClient) property for a description of the buddy object's properties.

See also:
  - onBuddyList:

  INFSmartFoxiPhoneClient::_buddyList

  - setBuddyBlockStatus:status: (INFSmartFoxiPhoneClient)

  - setBuddyVariables: (INFSmartFoxiPhoneClient)

Version:
  SmartFoxServer Basic / Pro

- (void) onBuddyPermissionRequest: |  | (INFSmartFoxSFSEvent *) | evt |  | `[optional]`

Dispatched when the current user receives a request to be added to the buddy list of another user.

The params object contains the following parameters.

Parameters:

  | sender | : (String) the name of the user requesting to add the current user to his/her buddy list.
  | message | : (String) a message accompaining the permission request. This message can't be sent from the client-side, but it's part of the advanced server-side buddy list features.

See also:
  - addBuddy: (INFSmartFoxiPhoneClient)

Since:
  SmartFoxServer Pro v1.6.0

Version:
  SmartFoxServer Pro

- (void) onBuddyRoom: |  | (INFSmartFoxSFSEvent *) | evt |  | `[optional]`

Dispatched in response to a getBuddyRoom (INFSmartFoxiPhoneClient) request.

The params object contains the following parameters.

Parameters:

  | idList | : (Array) the list of id of the rooms in which the buddy is currently logged; if users can't be present in more than one room at the same time, the list will contain one room id only, at 0 index.

See also:
  - getBuddyRoom: (INFSmartFoxiPhoneClient)

Version:
  SmartFoxServer Basic / Pro

- (void) onConfigLoadFailure: |  | (INFSmartFoxSFSEvent *) | evt |  | `[optional]`

Dispatched when an error occurs while loading the external SmartFoxClient configuration file.

The params object contains the following parameters.

Parameters:

  | message | : (String) the error message.

See also:
  - onConfigLoadSuccess:

  - loadConfig:autoConnect: (INFSmartFoxiPhoneClient)

Since:
  SmartFoxServer Pro v1.6.0

Version:
  SmartFoxServer Pro

- (void) onConfigLoadSuccess: |  | (INFSmartFoxSFSEvent *) | evt |  | `[optional]`

Dispatched when the external SmartFoxClient configuration file has been loaded successfully. This event is dispatched only if the autoConnect parameter of the loadConfig (INFSmartFoxiPhoneClient) method is set to true; otherwise the connection is made and the onConnection event fired.

No parameters are provided.

See also:
  - onConfigLoadFailure:

  - loadConfig:autoConnect: (INFSmartFoxiPhoneClient)

Since:
  SmartFoxServer Pro v1.6.0

Version:
  SmartFoxServer Pro

- (void) onConnection: |  | (INFSmartFoxSFSEvent *) | evt |  | `[optional]`

Dispatched in response to the connect (INFSmartFoxiPhoneClient) request. The connection to SmartFoxServer may have succeeded or failed: the success parameter must be checked.

The params object contains the following parameters.

Parameters:

  | success | : (Boolean) the connection result: true if the connection succeeded, false if the connection failed.
  | error | : (String) the error message in case of connection failure.

See also:
  - connect:port: (INFSmartFoxiPhoneClient)

Version:
  SmartFoxServer Basic / Pro

- (void) onConnectionLost: |  | (INFSmartFoxSFSEvent *) | evt |  | `[optional]`

Dispatched when the connection with SmartFoxServer is closed (either from the client or from the server).

No parameters are provided.

See also:
  - disconnect (INFSmartFoxiPhoneClient)

Version:
  SmartFoxServer Basic / Pro

- (void) onCreateRoomError: |  | (INFSmartFoxSFSEvent *) | evt |  | `[optional]`

Dispatched when an error occurs during the creation of a room. Usually this happens when a client tries to create a room but its name is already taken.

The params object contains the following parameters.

Parameters:

  | error | : (String) the error message.

See also:
  - createRoom:roomId: (INFSmartFoxiPhoneClient)

Version:
  SmartFoxServer Basic / Pro

- (void) onDebugMessage: |  | (INFSmartFoxSFSEvent *) | evt |  | `[optional]`

Dispatched when a debug message is traced by the SmartFoxServer API. In order to receive this event you have to previously set the debug (INFSmartFoxiPhoneClient) flag to true.

The params object contains the following parameters.

Parameters:

  | message | : (String) the debug message.

See also:
  INFSmartFoxiPhoneClient::_debug

Version:
  SmartFoxServer Basic / Pro

- (void) onExtensionResponse: |  | (INFSmartFoxSFSEvent *) | evt |  | `[optional]`

Dispatched when a command/response from a server-side extension is received.

The params object contains the following parameters.

Parameters:

  | dataObj | : (Object) an object containing all the data sent by the server-side extension; by convention, a String property called _cmd should always be present, to distinguish between different responses coming from the same extension.
  | type | : (String) one of the following response protocol types: INFSMARTFOXCLIENT_XTMSG_TYPE_XML (INFSmartFoxiPhoneClient) , INFSMARTFOXCLIENT_XTMSG_TYPE_STR (INFSmartFoxiPhoneClient) , INFSMARTFOXCLIENT_XTMSG_TYPE_JSON (INFSmartFoxiPhoneClient) . By default INFSMARTFOXCLIENT_XTMSG_TYPE_XML (INFSmartFoxiPhoneClient) is used.

See also:
  INFSmartFoxiPhoneClient::INFSMARTFOXCLIENT_XTMSG_TYPE_XML

  INFSmartFoxiPhoneClient::INFSMARTFOXCLIENT_XTMSG_TYPE_STR

  INFSmartFoxiPhoneClient::INFSMARTFOXCLIENT_XTMSG_TYPE_JSON

  - sendXtMessage:cmd:paramObj:type:roomId: (INFSmartFoxiPhoneClient)

Version:
  SmartFoxServer Pro

- (void) onJoinRoom: |  | (INFSmartFoxSFSEvent *) | evt |  | `[optional]`

Dispatched when a room is joined successfully.

The params object contains the following parameters.

Parameters:

  | room | : (Room) the INFSmartFoxRoom object representing the joined room.

See also:
  - onJoinRoomError:

  INFSmartFoxRoom

  - joinRoom:pword:isSpectator:dontLeave:oldRoom: (INFSmartFoxiPhoneClient)

Version:
  SmartFoxServer Basic / Pro

- (void) onJoinRoomError: |  | (INFSmartFoxSFSEvent *) | evt |  | `[optional]`

Dispatched when an error occurs while joining a room. This error could happen, for example, if the user is trying to join a room which is currently full.

The params object contains the following parameters.

Parameters:

  | error | : (String) the error message.

See also:
  - onJoinRoom:

  - joinRoom:pword:isSpectator:dontLeave:oldRoom: (INFSmartFoxiPhoneClient)

Version:
  SmartFoxServer Basic / Pro

- (void) onLogin: |  | (INFSmartFoxSFSEvent *) | evt |  | `[optional]`

Dispatched when the login to a SmartFoxServer zone has been attempted.

The params object contains the following parameters.

Parameters:

  | success | : (Boolean) the login result: true if the login to the provided zone succeeded; false if login failed.
  | name | : (String) the user's actual username.
  | error | : (String) the error message in case of login failure.

NOTE: the server sends the username back to the client because not all usernames are valid: for example, those containing bad words may have been filtered during the login process.

See also:
  - onLogout:

  - login:name:pass: (INFSmartFoxiPhoneClient)

Version:
  SmartFoxServer Basic / Pro

- (void) onLogout: |  | (INFSmartFoxSFSEvent *) | evt |  | `[optional]`

Dispatched when the user logs out successfully. After a successful logout the user is still connected to the server, but he/she has to login again into a zone, in order to be able to interact with the server.

No parameters are provided.

See also:
  - onLogin:

  - logout (INFSmartFoxiPhoneClient)

Since:
  SmartFoxServer Pro v1.5.5

Version:
  SmartFoxServer Basic / Pro

- (void) onModMessage: |  | (INFSmartFoxSFSEvent *) | evt |  | `[optional]`

Dispatched when a message from a Moderator is received.

The params object contains the following parameters.

Parameters:

  | message | : (String) the Moderator's message.
  | sender | : (User) the INFSmartFoxUser object representing the Moderator.

See also:
  - onAdminMessage:

  INFSmartFoxUser

  - sendModeratorMessage:type:id: (INFSmartFoxiPhoneClient)

Since:
  SmartFoxServer Pro v1.4.5

Version:
  SmartFoxServer Basic / Pro

- (void) onObjectReceived: |  | (INFSmartFoxSFSEvent *) | evt |  | `[optional]`

Dispatched when an Actionscript object is received.

The params object contains the following parameters.

Parameters:

  | obj | : (Object) the Actionscript object received.
  | sender | : (User) the INFSmartFoxUser object representing the user that sent the Actionscript object.

See also:
  INFSmartFoxUser

  - sendObject:roomId: (INFSmartFoxiPhoneClient)

  - sendObjectToGroup:userList:roomId: (INFSmartFoxiPhoneClient)

Version:
  SmartFoxServer Basic / Pro

- (void) onPrivateMessage: |  | (INFSmartFoxSFSEvent *) | evt |  | `[optional]`

Dispatched when a private chat message is received.

The params object contains the following parameters.

Parameters:

  | message | : (String) the private message received.
  | sender | : (User) the INFSmartFoxUser object representing the user that sent the message; this property is undefined if the sender isn't in the same room of the recipient.
  | roomId | : (int) the id of the room where the sender is.
  | userId | : (int) the user id of the sender (useful in case of private messages across different rooms, when the sender object is not available).

See also:
  - onPublicMessage:

  INFSmartFoxUser

  - sendPrivateMessage:recipientId:roomId: (INFSmartFoxiPhoneClient)

SmartFoxServer Pro v1.5.0 - roomId and userId parameters added.

Version:
  SmartFoxServer Basic / Pro

- (void) onPublicMessage: |  | (INFSmartFoxSFSEvent *) | evt |  | `[optional]`

Dispatched when a public chat message is received.

The params object contains the following parameters.

Parameters:

  | message | : (String) the public message received.
  | sender | : (User) the INFSmartFoxUser object representing the user that sent the message.
  | roomId | : (int) the id of the room where the sender is.

See also:
  - onPrivateMessage:

  INFSmartFoxUser

  - sendPublicMessage:roomId: (INFSmartFoxiPhoneClient)

Version:
  SmartFoxServer Basic / Pro

- (void) onRandomKey: |  | (INFSmartFoxSFSEvent *) | evt |  | `[optional]`

Dispatched in response to a getRandomKey (INFSmartFoxiPhoneClient) request.

The params object contains the following parameters.

Parameters:

  | key | : (String) a unique random key generated by the server.

See also:
  - getRandomKey (INFSmartFoxiPhoneClient)

Version:
  SmartFoxServer Pro

- (void) onRoomAdded: |  | (INFSmartFoxSFSEvent *) | evt |  | `[optional]`

Dispatched when a new room is created in the zone where the user is currently logged in.

The params object contains the following parameters.

Parameters:

  | room | : (Room) the INFSmartFoxRoom object representing the room that was created.

See also:
  - onRoomDeleted:

  INFSmartFoxRoom

  - createRoom:roomId: (INFSmartFoxiPhoneClient)

Version:
  SmartFoxServer Basic / Pro

- (void) onRoomDeleted: |  | (INFSmartFoxSFSEvent *) | evt |  | `[optional]`

Dispatched when a room is removed from the zone where the user is currently logged in.

The params object contains the following parameters.

Parameters:

  | room | : (Room) the INFSmartFoxRoom object representing the room that was removed.

See also:
  - onRoomAdded:

  INFSmartFoxRoom

Version:
  SmartFoxServer Basic / Pro

- (void) onRoomLeft: |  | (INFSmartFoxSFSEvent *) | evt |  | `[optional]`

Dispatched when a room is left in multi-room mode, in response of a leaveRoom (INFSmartFoxiPhoneClient) request.

The params object contains the following parameters.

Parameters:

  | roomId | : (int) the id of the room that was left.

See also:
  - leaveRoom: (INFSmartFoxiPhoneClient)

Version:
  SmartFoxServer Basic / Pro

- (void) onRoomListUpdate: |  | (INFSmartFoxSFSEvent *) | evt |  | `[optional]`

Dispatched when the list of rooms available in the current zone is received. If the default login mechanism provided by SmartFoxServer is used, then this event is dispatched right after a successful login. This is because the SmartFoxServer API, internally, call the getRoomList (INFSmartFoxiPhoneClient) method after a successful login is performed. If a custom login handler is implemented, the room list must be manually requested to the server by calling the mentioned method.

The params object contains the following parameters.

Parameters:

  | roomList | : (Array) a list of INFSmartFoxRoom objects for the zone logged in by the user.

See also:
  INFSmartFoxRoom

  - getRoomList (INFSmartFoxiPhoneClient)

Version:
  SmartFoxServer Basic / Pro

- (void) onRoomVariablesUpdate: |  | (INFSmartFoxSFSEvent *) | evt |  | `[optional]`

Dispatched when Room Variables are updated. A user receives this notification only from the room(s) where he/she is currently logged in. Also, only the variables that changed are transmitted.

The params object contains the following parameters.

Parameters:

  | room | : (Room) the INFSmartFoxRoom object representing the room where the update took place.
  | changedVars | : (Array) an associative array with the names of the changed variables as keys. The array can also be iterated through numeric indexes (0 to changedVars.length) to get the names of the variables that changed. NOTE: the changedVars array contains the names of the changed variables only, not the actual values. To retrieve them the getVariable / getVariables methods can be used.

See also:
  INFSmartFoxRoom

  - setRoomVariables:roomId:setOwnership: (INFSmartFoxiPhoneClient)

Version:
  SmartFoxServer Basic / Pro

- (void) onRoundTripResponse: |  | (INFSmartFoxSFSEvent *) | evt |  | `[optional]`

Dispatched when a response to the roundTripBench (INFSmartFoxiPhoneClient) request is received. The "roundtrip time" represents the number of milliseconds that it takes to a message to go from the client to the server and back to the client. A good way to measure the network lag is to send continuos requests (every 3 or 5 seconds) and then calculate the average roundtrip time on a fixed number of responses (i.e. the last 10 measurements).

The params object contains the following parameters.

Parameters:

  | elapsed | : (int) the roundtrip time.

See also:
  - roundTripBench (INFSmartFoxiPhoneClient)

Version:
  SmartFoxServer Basic / Pro

- (void) onSpectatorSwitched: |  | (INFSmartFoxSFSEvent *) | evt |  | `[optional]`

Dispatched in response to the switchSpectator (INFSmartFoxiPhoneClient) request. The request to turn a spectator into a player may fail if another user did the same before your request, and there was only one player slot available.

The params object contains the following parameters.

Parameters:

  | success | : (Boolean) the switch result: true if the spectator was turned into a player, otherwise false.
  | newId | : (int) the player id assigned by the server to the user.
  | room | : (Room) the INFSmartFoxRoom object representing the room where the switch occurred.

See also:
  - getPlayerId (INFSmartFoxUser)

  INFSmartFoxRoom

  - switchSpectator: (INFSmartFoxiPhoneClient)

Version:
  SmartFoxServer Basic / Pro

- (void) onUserCountChange: |  | (INFSmartFoxSFSEvent *) | evt |  | `[optional]`

Dispatched when the number of users and/or spectators changes in a room within the current zone. This event allows to keep track in realtime of the status of all the zone rooms in terms of users and spectators. In case many rooms are used and the zone handles a medium to high traffic, this notification can be turned off to reduce bandwidth consumption, since a message is broadcasted to all users in the zone each time a user enters or exits a room.

The params object contains the following parameters.

Parameters:

  | room | : (Room) the INFSmartFoxRoom object representing the room where the change occurred.

See also:
  - onUserEnterRoom:

  - onUserLeaveRoom:

  INFSmartFoxRoom

  - createRoom:roomId: (INFSmartFoxiPhoneClient)

Version:
  SmartFoxServer Basic / Pro

- (void) onUserEnterRoom: |  | (INFSmartFoxSFSEvent *) | evt |  | `[optional]`

Dispatched when another user joins the current room.

The params object contains the following parameters.

Parameters:

  | roomId | : (int) the id of the room joined by a user (useful in case multi-room presence is allowed).
  | user | : (User) the INFSmartFoxUser object representing the user that joined the room.

See also:
  - onUserLeaveRoom:

  - onUserCountChange:

  INFSmartFoxUser

Version:
  SmartFoxServer Basic / Pro

- (void) onUserLeaveRoom: |  | (INFSmartFoxSFSEvent *) | evt |  | `[optional]`

Dispatched when a user leaves the current room. This event is also dispatched when a user gets disconnected from the server.

The params object contains the following parameters.

Parameters:

  | roomId | : (int) the id of the room left by a user (useful in case multi-room presence is allowed).
  | userId | : (int) the id of the user that left the room (or got disconnected).
  | userName | : (String) the name of the user.

See also:
  - onUserEnterRoom:

  - onUserCountChange:

Version:
  SmartFoxServer Basic / Pro

- (void) onUserVariablesUpdate: |  | (INFSmartFoxSFSEvent *) | evt |  | `[optional]`

Dispatched when a user in the current room updates his/her User Variables.

The params object contains the following parameters.

Parameters:

  | user | : (User) the INFSmartFoxUser object representing the user who updated his/her variables.
  | changedVars | : (Array) an associative array with the names of the changed variables as keys. The array can also be iterated through numeric indexes (0 to changedVars.length) to get the names of the variables that changed. NOTE: the changedVars array contains the names of the changed variables only, not the actual values. To retrieve them the getVariable / getVariables methods can be used.

See also:
  INFSmartFoxUser

  - setUserVariables:roomId: (INFSmartFoxiPhoneClient)

Version:
  SmartFoxServer Basic / Pro