Real time notifications for web applications using nodejs, and redis pubsub

Recently I was working on a real time workflow for a module. I found it really difficult to find good tutorial for the same. I struggled with Flask, gevents and lot of other things and finally settled down to nodejs and and redis pubsub.

I have written a tutorial for the same

The beauty of nodejs is that everything was accomplished in less than 50 lines of code :). Read it and let me know if you have any feedback.


Tweet about this on Twitter0Share on Facebook0Share on Google+0Email this to someone
  • micheal

    roshan thanks for your article, i wanted to do similar project,
    my requirement is i should start the jobs, that is once the job is started, stored procedure must be executed frequently and update this results to the dashboard.
    and wanted to use mysql instead redis, is it possible
    please help?

    • Roshan Singh

      Who executes the stored procedures?

  • micheal

    node.js should call the stored procedure and reterive the result to the user

  • booking doctor

    thanks for your support, i am deploying a web application for my capstone project. My project using nodejs and your real time notification help me a lot, can you support me more? Regard

    • Roshan Singh

      Sure, tell me what do you want?

    • booking doctor

      when I insert/update a record into database from user has role A, how can I push a notification to user has role B? I am not sure when applying your code into my project?

      Thanks for your reply

      • Roshan Singh

        Use socket.emit() to broadcast message to one user or if you want to broadcast to multiple users you need to broadcast to a room. For broadcasting to a user, you will need to keep track of user’s socket.