push-style notifications similar to Facebook with Rails and jQuery

后端 未结 3 612
南旧
南旧 2020-12-29 16:38

I want to create a push notification system like Facebook. Whenever Facebook wants to tell you something (like that someone commented on a post, tagged you, etc), you\'ll se

3条回答
  •  谎友^
    谎友^ (楼主)
    2020-12-29 17:07

    Currently, such problems can be solved by using Comet.

    For more, http://en.wikipedia.org/wiki/Comet_(programming)

    Basically browsers use HTTP which is a stateless protocol and because it only works in a request then response kinda way, we can never really get a real push notification. When wanting to push to the browser we have to somehow mimick that TCP/Socket like connection to push to it. Comet is just a term that is used to define such techniques.

    There are many libraries which help in this.eg:- Orbited, Juggernaut on rails.

    With new browsers there is something called Websockets Protocol, the libraries I mentioned take advantage of this as well. Its a vast topic, but I am pretty sure, you ll find some basic examples with Juggernaut and Rails.

    There is also http://pusherapp.com, that does the same thing but charges money for it.

提交回复
热议问题