1.1.5 • Published 4 years ago

reroot-socket-io v1.1.5

Weekly downloads
-
License
MIT
Repository
-
Last release
4 years ago

Socket.IO Server Project

This Example project Server is built on top of:

To get details about socket client see Socket.IO Client Project Readme

What is used:

  • Socket.IO - Socket server module
  • Module socketio-jwt: Authorize socket connections via JWT token
  • Module ioredis: Adapter to enable broadcasting of events to multiple separate socket.io server nodes.
  • Module redis: Pub/Sub client.

How it works:

Client connects.

Client emit subscribe event and gets subscribed. Client is subscribed to socket only on user endpoint channel. Next, client gets subscribed to redis via all channel subscribed by endpoint. This creates single point of message output to client (via user endpoint).

Take note:

  • If client has connected with "ack: true", after user subscribes server tries to find all messages that client (user) did not recieve and tries to resend them (Acknowledgement)

When subscribed redis channel gets message:

  • Server validates and processes payload
  • Publishes message on socket endpoint channel