Click or drag to resize

SmartFox Class

SmartFox is the main class of the SmartFoxServer 2X API.
Inheritance Hierarchy
SystemObject
  Sfs2XSmartFox

Namespace:  Sfs2X
Assembly:  SmartFox2X (in SmartFox2X.dll) Version: 1.8.0.0 (1.8.0)
Syntax
C#
public class SmartFox

The SmartFox type exposes the following members.

Constructors
  NameDescription
Public methodCode exampleSmartFox
Creates a new SmartFox instance.
Public methodCode exampleSmartFox(Boolean)
Creates a new SmartFox instance.
Public methodCode exampleSmartFox(UseWebSocket)
Creates a new SmartFox instance enabling websocket communication instead of the default socket communication.
Public methodCode exampleSmartFox(UseWebSocket, Boolean)
Creates a new SmartFox instance enabling websocket communication instead of the default socket communication.
Top
Properties
  NameDescription
Public propertyBuddyManager
Returns a reference to the Buddy Manager.
Public propertyCompressionThreshold
Returns the current compression threshold.
Public propertyConfig
Returns the client configuration details.
Public propertyCode exampleConnectionMode
Returns the current connection mode after a connection has been successfully established.
Public propertyCurrentIp
Returns the IP address or domain name of the SmartFoxServer 2X instance to which the client is connected.
Public propertyCurrentPort
Returns the TCP port of the SmartFoxServer 2X instance to which the client is connected.
Public propertyCurrentZone
Returns the Zone currently in use, if the user is already logged in.
Public propertyDebug
Indicates whether the client-server messages debug is enabled or not.
Public propertyHttpUploadURI
Returns the HTTP URI that can be used to upload files to SmartFoxServer 2X, using regular HTTP POST.
Public propertyCode exampleIsConnected
Indicates whether the client is connected to the server or not.
Public propertyJoinedRooms
Returns a list of Room objects representing the Rooms currently joined by the client.
Public propertyLastJoinedRoom
Returns the object representing the last Room joined by the client, if any.
Public propertyLogger
Returns a reference to the internal Logger instance used by SmartFoxServer 2X.
Public propertyMaxMessageSize
Returns the maximum size of messages allowed by the server.
Public propertyMySelf
Returns the User object representing the client when connected to a SmartFoxServer 2X instance.
Public propertyNodeId
[CLUSTER] The identifier of the cluster node which the current SmartFox instance is connected to. If the instance is not connected, a null value is returned;
Public propertyRoomList
Returns a list of Room objects representing the Rooms currently "watched" by the client.
Public propertyRoomManager
Returns a reference to the Room Manager.
Public propertySessionToken
Returns the unique session token of the client.
Public propertyThreadSafeMode
Sets the API to run with an event queue that needs to be processed by the client.
Public propertyUdpAvailable
Indicates whether the UPD protocol is available or not in the current runtime.
Public propertyUdpInited
Indicates whether the UDP handshake has been performed successfully or not.
Public propertyUserManager
Returns a reference to the User Manager.
Public propertyVersion
Returns the current version of the SmartFoxServer 2X C# API.
Top
Methods
  NameDescription
Public methodCode exampleAddEventListener
Adds a delegate to a given API event type that will be used for callbacks.
Public methodCode exampleAddLogListener
Registers a delegate method for log messages callbacks.
Public methodConnect
Public methodCode exampleConnect(ConfigData)
Establishes a connection between the client and a SmartFoxServer 2X instance using a configuration object.
Public methodConnect(String)
Public methodCode exampleConnect(String, Int32)
Establishes a connection between the client and a SmartFoxServer 2X instance.
Public methodDisconnect
Closes the connection between the client and the SmartFoxServer 2X instance.
Public methodEnableLagMonitor(Boolean)
Public methodEnableLagMonitor(Boolean, Int32)
Public methodEnableLagMonitor(Boolean, Int32, Int32)
Enables the automatic realtime monitoring of the lag between the client and the server (round robin).
Public methodCode exampleGetRoomById
Retrieves a Room object from its id.
Public methodCode exampleGetRoomByName
Retrieves a Room object from its name.
Public methodGetRoomListFromGroup
Retrieves the list of Rooms which are part of the specified Room Group.
Public methodCode exampleInitCrypto
Initializes the connection cryptography to protect all client-server communications with standard TLS protocol.
Public methodInitUDP
Public methodInitUDP(String)
Public methodCode exampleInitUDP(String, Int32)
Initializes the UDP protocol by performing an handshake with the server.
Public methodKillConnection
Simulates an abrupt disconnection from the server.
Public methodLoadConfig
Public methodLoadConfig(Boolean)
Public methodLoadConfig(String)
Public methodCode exampleLoadConfig(String, Boolean)
Loads the client configuration file.
Public methodCode exampleProcessEvents
Tells the API to process all event queues and execute the delegate callbacks.
Public methodRemoveAllEventListeners
Removes all event listeners.
Public methodRemoveEventListener
Removes a delegate registration for a given API event.
Public methodRemoveLogListener
Removes a delegate method for log messages callbacks.
Public methodCode exampleSend
Sends a request to the server.
Public methodSetClientDetails
Allows to set custom client details used to gather statistics about the client platform in the SFS2X Analytics Module.
Top
Remarks
This class is responsible for connecting the client to a SmartFoxServer instance and for dispatching all asynchronous events. Developers always interact with SmartFoxServer through this class.

NOTE: in the provided examples, sfs always indicates a SmartFox instance.

Author: The gotoAndPlay() Team
http://www.smartfoxserver.com

See Also