SetPersistentId

The first time a client connects there will be no persistentId. The server will then create and add a persistentId that the client will store in localstorage. This value will then be resued when connecting so that the server recognize the client.

The server will kick other clients with the same persistentId when a new client connects. This will be obvious if you open a new browser window (or tab) to the same page. The first client will then be disconnected.

If you have the need for multiple windows/tabs on the same client you can use setPersistentId() to make sure that each connection have a unique persistentId.

<script>
    var conn = new xsockets.client('ws://localhost:4502');
    conn.setPersistentId(xsockets.utils.guid());
    conn.open();
</script>

results matching ""

    No results matching ""