

Topics such as scalability, performance, connection recovery, robust handling of different edge cases, handling of large messages (e.g. There are a lot of things to consider when building a WebSocket server, and the intent here is just to demonstrate a starting point.
NODEJS WEBSOCKET HOW TO
You should also see how to use NPM to install packages, as I’ll be assuming at least a little familiarity with these as we continue. Note: If you’ve never touched Node.js in your life, you should check out a few Node.js tutorials to get a simple Node.js server running on your machine. They all follow the same standard specifications for interpreting and constructing HTTP requests and responses, and for parsing and generating data that uses the WebSocket framing protocol.įor now, though, I’ll assume you have at least some familiarity with Node.js. The actual concepts will be fairly consistent though.

The implementation in each of those environments will vary depending upon the HTTP server libraries available. I’ll be using Node.js for this (version 10.7 is installed on my machine at the time of this article).

You can take your learning a bit further with another great article about long polling. In this article, we’ll see how to implement a WebSocket server using Node.js.īefore we jump right in - if you are not familiar with WebSockets as a transport protocol, here’s a brilliant article that you should read.
