Creates a new SmartFox instance enabling websocket communication instead of the default socket communication.

Namespace: Sfs2X
Assembly: SmartFox2X (in SmartFox2X.dll) Version: 1.7.3.0 (1.7.3)

Syntax

C#
public SmartFox(
	UseWebSocket useWebSocket,
	bool debug
)

Parameters

useWebSocket
Type: Sfs2X.Util..::..UseWebSocket
If set to UseWebSocket.WS_BIN, non-secure websocket communication (WS) is used; if set to UseWebSocket.WSS_BIN, secure websocket communication (WSS) is used.
debug
Type: System..::..Boolean
If true, the SmartFoxServer API debug messages are logged.

Remarks

IMPORTANT: this constructor should be used in Unity only and when building for the web only (Unity WEBGL). In fact it is preferable to use the default socket communication, as websocket connection doesn't support BlueBox and HRC systems, the protocol is not binary and not compressed.
This constructor is not available in .Net and Windows Universal DLLs (websocket communication not supported, because redundant).

Starting from API v1.7.3, websocket communication uses the default SFS2X binary protocol (see UseWebSocket class). Legacy text protocol is still available for backward compatibility with SmartFoxserver 2X versions prior to 2.13.

Examples

The following example instantiates the SmartFox class enabling secure websocket communication and debug messages:
 Copy imageCopy
SmartFox sfs = new SmartFox(UseWebSocket.WSS_BIN, true);

See Also