The error event is triggered when the browsers websocket API fires a error event. Below we catch errors by having autoreconnect set to true and then try to connect to a server that is not available so that we will get a connection error every 5 seconds.

    var conn = new xsockets.client('ws://localhost:666');
    conn.onError = function (e) {
        console.log('Error occured', e);

results matching ""

    No results matching ""