Reputation: 973
I am into a process of developing the facebook or stackoverflow like notification in my rails app. when the new activity gets stored in the database i get the new notification flashed on the browser. without refreshing the page. there is a way by giving ajax request with the setInterval . but that looks so dull as there will be many requests on the server , i just want to flash notification on the homepage only when it gets stored in the database
How can i achieve this ?
Upvotes: 1
Views: 243
Reputation: 1311
Unfortunately there is no "take this code and be happy" solution for your problem, since what you are asking for are websockets and rails 4 doesn't support them out of the box (rails 5 does with the new "action_cable").
You might want to have a look at these links:
Upvotes: 1