← Stack

WebSockets

The right tool for anything that needs to be live.

SINCE
2023
PROFICIENCY
84%

FTC Dashboard's chat uses a custom WebSocket server with mention parsing (@username), read receipts, message history, and online presence. I built both client and server from scratch using the ws library — I wanted to understand the protocol, not abstract it away with Socket.io.

I USE IT FOR
  • Real-time chat and messaging
  • Live dashboards with server-pushed updates
  • Collaborative tools
  • Features where polling would be embarrassing
CODE SAMPLE
const wss = new WebSocketServer({ port: 8080 });

wss.on("connection", (ws) => {
  ws.on("message", (data) => {
    wss.clients.forEach(client => {
      if (client.readyState === WebSocket.OPEN)
        client.send(data);
    });
  });
});