In this article, I’m going to explain to you how socket.io works. Let’s get started!
Socket.io consists of a few modules. you can see it on npm packages
- debugengine.io
- has-binary2
- socket.io-adapter
- socket.io-client
- socket.io-parser
These modules have inside a few other packages. It’s a big bunch of modules. I want to breakdown socket.io-redis. This module linked with socket.io-Adapter. but they’re all linked to socket.io-adapter. I thought it used for the only socket.io-redis, but ok, passed. In this articles will be step by step breaking down all modules until we will know how it works. I’m going to pass you by the road.
How does it work on the surface?
Bunch modules. There I saw a few times two functions suck as encode and decode. These functions from the socket.io-parser. Encode is used for transfer data from socket.io to engine.io and decode for the opposite from engine.io to socket.io.