onClose

When closing the connection you can choose to pass in a parameter to tell the API if it should try to autoReconnect. By default the parameter is set to false.

<script>
    var conn = new xsockets.client('ws://localhost:4502');
    conn.onOpen = function (e) {
        console.log('Connection Open, but will be closed in 5 seconds');
        setTimeout(function () { conn.close(); }, 5000);
    }
    conn.onClose = function (e) {
        console.log('Connection Closed', e);
    }
    conn.open();
</script>

results matching ""

    No results matching ""