1

I am designing a system with Socket.io, Nodejs, Expressjs, Redis, Angularjs in which message delivery is very crucial.

Use Case:

My system needs to listen for notifications on resources which can also be shared among multiple users. Sockets are connected to the server with information about resource so that I can maintain a list of sockets for each resource. When there is a notification for that resource I send notification on every socket for that resource.

ResourceID1 = ["scoketID1", "socketID2"] // Two sockets listening to ResourceID1

I update this list on socket disconnect also by removing that specific socket id out or resourceID list.

This way I make sure notification is sent to every user which is sharing the resource and every session of that user along with every socket which can be multiple tabs for one session. In short "Every Socket".

I am also maintaining a hash for the resource notification so that every time there is a new notification for a resource the particular resource notification hash will be updated.

ResourceID1-notificationHash : { key1:"124", key2: "abc" }

The reason for doing this is that if the socket disconnected like user closed the tab or more importantly user Internet disconnected for some reason. and the server does not receive heart beat socket connection is made again and the last message for that resource is sent to that socket.

To make sure that particular socket(client) always receive the message is my implementation enough?

I know I can implement callbacks for an event but what I did is when a particular tab(socket)that was disconnected, is connected again I send the last message for that resource.

Are there any other network glitches which can cause problems for reliable message delivery?

My implementation is different in a sense that for message delivery I am not considering Users, I am considering sockets which can be multiple for just one user like one user can have multiple sessions at the same time lets say in firefox and chrome and then for each session he can have multiple tabs opened. Reason for choosing sockets is my resources can be shared among multiple users so that for one resource update I may have to send the message to multiple users each having multiple sessions and each session having multiple sockets.

Achilles
  • 519
  • 7
  • 27
  • Possible duplicate of [Websocket transport reliability (Socket.io data loss during reconnection)](https://stackoverflow.com/questions/20685208/websocket-transport-reliability-socket-io-data-loss-during-reconnection) – EMX Aug 23 '17 at 20:59
  • @EMX I am more concerned about network glitches and cases when the system I implemented can fail. Another thing is which is different from the question the question you pointed out is that my system considers individual sockets while sending the message that system is considering Users. – Achilles Aug 23 '17 at 21:03

0 Answers0