Disconnect
public void Disconnect();
Description
Disconnects from the real-time notification server.
You must call this function when closing the app.
Example
//Define the handler to be called upon disconnection.
Backend.Notification.OnDisConnect = (string Reason) => {
Debug.Log("Reason for disconnection : " + Reason);
};
//Disconnect from the real-time notification server
Backend.Notification.DisConnect();
OnDisConnect
public OnDisconnect OnDisConnect;
Parameter
Value | Type | Description |
---|---|---|
Reason | string | Reason for disconnection |
Description
This event handler is called when Disconnect finishes. The reason for disconnection is returned via Reason.
This handler is also called when abnormal disconnection occurs.
Example
Backend.Notification.OnDisConnect = (string Reason) => {
Debug.Log("Disconnected from the real-time notification server!");
Debug.Log("Reason for disconnection : " + Reason);
};
Return cases
Possible reasons:
Reason | Side | Description |
---|---|---|
transport error | Server Side | Transport error |
server namespace disconnect | Server Side | Server performs a socket.disconnect() |
client namespace disconnect | Client Side | Got disconnect packet from client |
ping timeout | Client Side | Client stopped responding to pings in the allowed amount of time(per the pingTimeout config setting) |
transport close | Client Side | Client stopped sending data |