Skip to main content
Version: 5.11.6

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

ValueTypeDescription
ReasonstringReason 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:

ReasonSideDescription
transport errorServer SideTransport error
server namespace disconnectServer SideServer performs a socket.disconnect()
client namespace disconnectClient SideGot disconnect packet from client
ping timeoutClient SideClient stopped responding to pings in the allowed amount of time(per the pingTimeout config setting)
transport closeClient SideClient stopped sending data