Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Send notification to a particular User List using Node socket.io

I am using NodeJS,Scoket.io

I am trying to send notifications like Facebook. If there are 1000 Users and User A have 50 friends then Notification is send to those 50 Users. I do not want to broadcast for all Users

What is the efficient way to do this ?

like image 238
abhaygarg12493 Avatar asked Jul 22 '15 19:07

abhaygarg12493


1 Answers

If a user has lots of friends then you can have all of those friends listening to a namespace or room for that user.

The explanation and example is here: http://socket.io/docs/rooms-and-namespaces/

like image 95
Jason Livesay Avatar answered Nov 19 '22 08:11

Jason Livesay