user4965201
user4965201

Reputation: 973

Ruby on rails facebook like notification without page refresh

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

Answers (1)

Ninigi
Ninigi

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:

pusher web sockets

websockets rails gem

pusher gem tutorial

Upvotes: 1

Related Questions