Simple WebSocket echo server.
- The
BIND_ADDRESSenvironment variable specifes the address on which the server will start listening for connections. The default value is::. - The
BIND_PORTenvironment variable specifies the port on which the server will start listening for connections. The default value is1337. - The
HEARTBEAT_INTERVALenvironment variable specifies the interval, in milliseconds, at which the server sends a ping message to all connected clients to detect and close unresponsive connections. The default value is30000. - The
HIGH_WATER_MARKenvironment variable specifies a threshold in bytes for the outgoing buffered data of each connection. If the threshold is exceeded no more data is read until all the outgoing buffered data is flushed. The default value is16384. - The
MAX_MESSAGE_SIZEenvironment variable specifies the maximum allowed message size in bytes. The default value is65536.
git clone https://github.com/websockets/websocket-echo-server.git
cd websocket-echo-server
npm ci --production
node index.js
git clone https://github.com/websockets/websocket-echo-server.git
cd websocket-echo-server
docker build -t websocket-echo-server .
docker run -e BIND_PORT=8080 --expose 8080 -d -p 8080:8080 websocket-echo-server