简体   繁体   中英

Rails Notification Without Page Refresh

I created a simple private messaging app through rails, but I am trying to get it to simply show that new message has arrived without the person having to refresh the page.

I am looking at State Machine because I am thinking that it might be a part of building something like this. Can anyone push me in the right direction?

Thanks.

The simplest way to do that using javascript is to periodically send requests to the server using setTimeout + $.get() .

Another a little bit more complicated way is to use gems like faye . There is nice railscast on this theme.

Take a look at any of the messaging protocols like:

Faye

Socket.IO

or hosted sollutions like PubNub or Pusher

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM