SFSEventCONNECTION_LOST Field |
Dispatched when the connection between the client and the SmartFoxServer 2X instance is interrupted.
Namespace:
Sfs2X.Core
Assembly:
SmartFox2X (in SmartFox2X.dll) Version: 1.8.0.0 (1.8.0)
Syntax public static readonly string CONNECTION_LOST
Field Value
Type:
StringRemarks
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.
Parameter | Description |
---|
reason | (string) The reason of the disconnection, among those available in the ClientDisconnectionReason class. |
Examples
The following example handles a disconnection event:
void SomeMethod() {
sfs.AddEventListener(SFSEvent.OnConnectionLost, OnConnectionLost);
}
void OnConnectionLost(BaseEvent evt) {
Console.WriteLine("Connection was lost, Reason: " + (string)evt.Params["reason"]);
System.Diagnostics.Debug.WriteLine("Connection was lost, Reason: " + (string)evt.Params["reason"]);
}
See Also