Skip to content

Latest commit

 

History

History
25 lines (13 loc) · 1.78 KB

11-websocket.md

File metadata and controls

25 lines (13 loc) · 1.78 KB

🐢 Node.js

WebSocket

It's not uncommon that as a Junior or a newcomer, one of our ideas is to realize an application using real time through WebSockets (be it for a chat, a game or others).

Most of the time everyone will have the reflex to start with the socket.io library (which I did myself) which is quite accessible for beginners and brings you a lot of cool features like rooms.

However, now with my experience, I would also recommend you to seriously consider not using socket.io directly which will abstract a lot of elements from you and can sometimes prevent you from better understanding different fundamentals (or taking advantage of native features).

It's also I think a great training (if you can do it then socket.io is a summer camp on the side).

In short, don't hesitate to take an interest in the native WebSockets API of the browser (and the npm WebSockets package for the back-end). You can also be interested in gRPC which will use protocol buffers for messages (more technical but it will look better on your resume).

If your need is very high performance I recommend you take a look at uWebSockets (which has a minimalist room system too).

Additional Resources (articles, videos, talks)


⬅️ 🐢 Node.js: Modules (CJS & ESM) | ➡️ 🐢 Node.js: 📊 Unit testing and coverage