You can choose to close the connection by calling the
close() method. You can also pass in an optional paramterer (boolean) that tells the connections to autoreconnect if set to true. By default the parameter is set to false.
<script> var conn = new xsockets.client('ws://localhost:4502'); // ... // ... // ... // you decide to close the connection for some reason conn.close(); </script>