Mail send alert to user

Hello,
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).
Thanks

I believe that google actually refreshes periodically - not the html
page,
but gmail is basically one big javascript framework so it amounts to the
same thing.

anyway, what you can do is create a periodic call to the server - every
10
seconds, 30 seconds, whatever - to check if there is a new entry - if
there
is no new entry, do nothing (user doesn’t experience anything) - if
there is
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
last
the page was updated.

that would be my suggestion, but I am sure there are other people who
can
suggest alternatives

regards
ivor