I have made an message send/receive system for my page in ruby on rails.
It works great but the only thing is that i need to refresh every time
the page to see if i have new messages. Could someone help me with a
tutorial, or example of how to send alert from server to user window
when he get a new message.
I don’t wan’t to put an observer function to refresh the page every 10
seconds. I wan’t to tell to the application when a new row is inserted
in message table to notice user that he gets a new message(like google).
I believe that google actually refreshes periodically - not the html
anyway, what you can do is create a periodic call to the server - every
seconds, 30 seconds, whatever - to check if there is a new entry - if
is no new entry, do nothing (user doesn’t experience anything) - if
new entry you can insert the new entry using page.insert instead of
reloading the entire page. you can also update a section showing when
the page was updated.
that would be my suggestion, but I am sure there are other people who