Reputation: 1331
We are using JS polling to see if data has arrived in a particular table and doing a redirect from the frontend. Does Rails have some kind of a notification mechanism so that user is redirected from the Rails controller.
Some kind of a publisher subscriber mechanism such that Rails controller is looking out for a particular change and does a redirect as soon as change happens
Upvotes: 0
Views: 185
Reputation: 1494
You need Action Cable. Action Cable seamlessly integrates WebSockets with the rest of your Rails application. It allows for real-time features to be written in Ruby in the same style and form as the rest of your Rails application, while still being performant and scalable. It's a full-stack offering that provides both a client-side JavaScript framework and a server-side Ruby framework. You have access to your full domain model written with Active Record or your ORM of choice.
Here is great example which shows usage of action cable
https://blog.heroku.com/real_time_rails_implementing_websockets_in_rails_5_with_action_cable
Hope it helps.
Upvotes: 3