Web Socket application using only Node.js built-in modules

About

Welcome, this repo is part of my youtube video about Building a complete application implementing the Web Socket protocol using only Node.js built-in modules.

First of all, leave your star 🌟 on this repo.

Access our exclusive telegram channel so I’ll let you know about all the content I’ve been producing

Complete source code

Features Checklist + Challenges

  • Web Socket Server

    • Receiving data
      • Establishes handshake connections according to the Web Socket protocol
      • Receives masked data payloads
      • Decodes 7-bits long data payloads
      • Decodes 16-bits long data payloads
      • Decodes 64-bits long data payloads
    • Replying
      • Builds data frames according to the Web Socket protocol
      • Sends 7-bits long unmasked data payloads
      • Sends 16-bits long unmasked data payloads
      • Sends 64-bits long unmasked data payloads
  • Web Socket Client

    • Establishes handshake connections according to the Web Socket protocol
    • Sends masked data payloads
    • Receives masked and unmasked data payloads
    • Tries reconnecting to the server after a disconnection

Notes

  • Should you have some difficulties solving the problems, please comment on the Youtube video

  • As soon as you’ve been finishing the tasks, comment on the Youtube video so all other students can be pushed forward by your efforts

Running

  • Server – Use the Node.js v18 and execute the server.mjs file as node nodejs-raw-websocket/server.mjs
  • Client – You just need to open the index.html file on a browser. (I use Firefox for the examples)

Have fun!

GitHub

View Github