How will you implement 'Currently Editing' functionality in Socket.io, JavaScript, Node.js?
I have content in a textarea which can be edited by multiple people. I would like to know what's the best way to show who's currently writing in that textarea realtime?
A simple way to go about this is using Messaging Queues. Let's have a look.
For this, we make a couple of assumptions:
there has to be someone who starts editing the document, right?
if so, there is something they share.
Now, in very simple terms, a messaging queue is a stack of messages. What you can do is use the Pub/Sub (Publish/Subscribe) method. So, the first guy to edit it, creates an event; and subscribes to it. Then, whenever someone else edits it, his name is added to the queue. Since it's already subscribed to itself, the document will get the new user notification, and then you can use it wherever you feel like.
I'd say you use Redis as it provides a really good implementation of Pub/Sub. There is also ZeroMQ, if you feel a little cool. ;)
If you need a demo app, I'd love to cook up an open source example. I hope this helps! :)
Shreyansh Pandey
node, coffee and everything in between
A simple way to go about this is using Messaging Queues. Let's have a look.
For this, we make a couple of assumptions:
Now, in very simple terms, a messaging queue is a stack of messages. What you can do is use the Pub/Sub (Publish/Subscribe) method. So, the first guy to edit it, creates an event; and subscribes to it. Then, whenever someone else edits it, his name is added to the queue. Since it's already subscribed to itself, the document will get the new user notification, and then you can use it wherever you feel like.
I'd say you use Redis as it provides a really good implementation of Pub/Sub. There is also ZeroMQ, if you feel a little cool. ;)
If you need a demo app, I'd love to cook up an open source example. I hope this helps! :)