use socket.io in javascript code example
Example 1: socket io script
<script src="/socket.io/socket.io.js"></script>
<script>
const socket = io();
</script>
Example 2: socket io node js
npm install socket.io
<script src="/socket.io/socket.io.js"></script>
<script>
const socket = io();
</script>
npm install socket.io