Skip to main content

Websocket Disconnected

In some situations it is possible that server disconnects WebSocket connection. In this case reopen connection and related wires to not lose any event data.

webSocket.onerror = function (error) {
console.log("WebSocket Error:", error);

// REOPEN the WebSocket connection and all related wires..
};

webSocket.onclose = function () {
console.log("WebSocket Closed!");

// REOPEN the WebSocket connection and all related wires..
};

To re-open disconnected WebSocket connection and wire you need to create new WebSocket connection and send the OPEN message again. For more information see Creating WebSocket connection and OPEN message.