Monday 13 March 2017

Socket io on ELB, need to connect to all instances of application servers

I have a socket server application written on node js, hosted on Amazon ELB which is managed by load balancer

Clients connects to the socket and pass specified id, say event_id my application creates room with name "event_event_id" and join the room. Different clients have different "event_id"

A lambda function connects to the socket and emits an event named "event_push" to the application with necessary data such as event_id

Whenever my socket application detects a push event with event_id, it broadcast the pushed data to all members of the room "event_event_id", thus all members gets notified of the event

clients can connect any of the servers, decided by load balancer and sticky sessions can maintain the connection

Now my problem: Is there a way to emit the "event_push" to only the server having a room named "event_event_id"

Qn: Is there a way to emit an event to all instances of the servers? OR Qn: Is there any alternate solutions?



via Ima

No comments:

Post a Comment