Reputation: 129
working on a Hotel Booking Website.
There is one Master Table.I want to show a Notification when New record is inserted in Master Table.
Suppose I am on Dashboard of Admin Panel. So to check for the new entry in Master table, I am repeatedly calling a Ajax function. If I found a new entry , I am showing a Notification.
But Now I don't want to hit database all the time by using Ajax call, if there is no booking.
I don't want to use AJAX.
Is there any other way ?
So how can I, from a view page, keep watching Master table for new records and then show Notification for those values in the view?
Upvotes: 1
Views: 4184
Reputation: 678
You need to look at a WebSocket solution. You can host your own with something like Slanger (https://github.com/stevegraham/slanger) or use a hosted service like Pusher (http://pusherapp.com). Both of these will let you set up realtime communication between your server and the client (web browser). You can add a hook in your code to send out a notification to your user/s every time a record is added.
Upvotes: 2