简体   繁体   中英

Node.js/Socket.io realtime webpage push updates

I am looking to implement/add realtime push notification updates from node.js server to browser (client).

I looked into socket.io ( http://socket.io/docs/rooms-and-namespaces/ )

business requirement is - users will visit a page displaying customer info & their orders. There will be ~10,000 users visiting the page at any given time (all 10,000 could be for different customers or sometimes a user may have opened the same page in 2 or 3 tabs)

When orders flow in to elasticsearch for a customer (my datastore) i want to push notification to users who have that customer's page opened.

Questions:

  1. Is socket.io the correct framework for this case?
  2. Am I correct in understanding I have to use socket.io' rooms functionality to implement this? (each room identifier equals customer ID?)
  3. Is this implementation scalable and would it be memory intensive for 10k users on node.js server?

Thanks!

  1. Yes, but you could consider socksJS as well and write your own simple back-end.
  2. Yes, it's the easiest way if you need authentication.
  3. Worst case scenario you'd need to cluster your socket.io servers and use a back-end adapter. Redis should be fast enough for 10.000 connections.

EDIT: memory will depend on your specific implementation.

Also consider https://github.com/Automattic/socket.io/issues/1393

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM