Dispatched when the connection between the client and the SmartFoxServer 2X instance is interrupted.

Namespace: Sfs2X.Core
Assembly: SmartFox2X (in SmartFox2X.dll) Version: 1.7.0.0 (1.7.0)

Syntax

C#
public static readonly string CONNECTION_LOST

Field Value

Type: String

Remarks

This event is fired in response to a call to the Disconnect()()()() method or when the connection between the client and the server is interrupted for other reasons.

The Params object contains the following parameters.

ParameterDescription
reason(string) The reason of the disconnection, among those available in the ClientDisconnectionReason class.

Examples

The following example handles a disconnection event:
 Copy imageCopy
void SomeMethod() {
    sfs.AddEventListener(SFSEvent.OnConnectionLost, OnConnectionLost);
}
void OnConnectionLost(BaseEvent evt) {
    Console.WriteLine("Connection was lost, Reason: " + (string)evt.Params["reason"]);                      // .Net / Unity
    System.Diagnostics.Debug.WriteLine("Connection was lost, Reason: " + (string)evt.Params["reason"]);     // Windows Universal
}

See Also