WebSocket Node js server and API for it
Run container with service. The default WebSocket server listens on port 81, while the api server listens on port 80.
docker run -d -p 8080:80 -p 8081:81 wolfwalker/node-ws-service
Use Socket.io client or any other WebSocket client to establish a connection
<script src="http://localhost:8081/socket.io/socket.io.js"></script>
<script>
const socket = io.connect('ws://localhost:8081/io/ws')
socket.on('connect', () => {
// When connecting, you must pass the id with which you can send the message via api
socket.emit('join', ({id: 123}))
})
</script>
Use the server API to interact with the WebSocket connections