0

I'm gearing up to release a websocket heavy web app. I've written it in Node.js, using Socket.io and MongoDB. I'm using LearnBoost's Up to run the app, so to minimise downtime when updating code on the server, but I wonder, is there something out there to help me manage to the websocket connections that are active?

I basically want to see who is online at any given moment and be able to send an admin message out to all that is connected. I wonder if there is something that allows me to do this? Or would I just need to code my own?

Thanks, James

littlejim84
  • 9,071
  • 15
  • 54
  • 77
  • Is [this](http://stackoverflow.com/a/7352443/514749) what you're looking for? It says how you can emit data to all connectec users at a particular moment in time. – pimvdb Mar 27 '12 at 12:22

1 Answers1

1

I'm not using node.js but essentially in any websocket application there should be a list of connected clients maintained somewhere on server side. If you're not doing it manually then some part of your application stack is doing it for you. All you need to do is to get hold of that list, iterate and send messages to all of them.

If you could intercept call to onOpen()/onClose() on server side you could maintain (copy of) such list yourself.

maximdim
  • 8,041
  • 3
  • 33
  • 48