Setting up WebSocket and Socket.io Real-Time Servers | NodeFlux.eu Docs

Host real-time bidirectionally connected apps using Socket.io or native ws module on assigned service ports.

Steps

  1. Install socket.io or ws package in your Node.js application.
  2. Attach Socket.io instance to your HTTP server listening on process.env.PORT.
  3. Configure CORS origins in Socket.io initialization to allow requests from your web frontend domain.
  4. Implement heartbeats and ping timeouts to automatically clean up disconnected client sockets.
  5. Deploy application files to NodeFlux and start the service.
  6. Connect from client browser code using: const socket = io("http://node-host:port");

Notes