5

Is there any Ruby/Rails library for sending PostgreSQL asynchronous notifications via WebSockets?

I need to notify a browser client for updates in a specific database table. I know this can be done with pub/sub APIs, but I'm looking for a Postgres only solution.

I've found a Python tutorial for this, but couldn't find one for Ruby. I need to implement this for production use, so a production-ready library and tutorial would be the best.

1
  • 2
    I wrote a Rails3-Plugin for exactly this scenario. Sadly it is closed source (it was paid work), but you can implement it on your own very easily. There is a EventMachine plugin for websockets and you can use Model.execute() to listen/notify. Only thing you have to bare in mind is that MRI is not multithreaded (look for GIL), so I used jruby instead of MRI for the websockets server. Commented Apr 5, 2013 at 8:31

1 Answer 1

2

I don't know directly about any that does work with websockets, but queue_classic gem uses listen/notify in postgres for a message queueing. It's a good way to start looking how it can be done.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.