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)


public SmartFox(
	UseWebSocket 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.


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.


The following example instantiates the SmartFox class enabling websocket communication:
 Copy imageCopy
SmartFox sfs = new SmartFox(UseWebSocket.WS_BIN);

See Also