1io.connect('http://localhost', {
2 'reconnection': true,
3 'reconnectionDelay': 500,
4 'reconnectionAttempts': 10
5});
1<script src="/socket.io/socket.io.js"></script><script> const socket = io('http://localhost');</script>
1var ws = new WebSocket('ws://localhost/socket.io/?EIO=3&transport=websocket');
2ws.send('42' + JSON.stringify(['hello', 'there']));
3// ws.onmessage will get a MessageEvent object with the data property being encoded in the similar way.
4