开发者

Utilizing Twitter's Streaming API w/ jQuery?

Twitter's Streaming API seems to provide a way to receive realtime tweets without constantly polling for new data. Would it be possible to make use of this API using jQuery (or maybe falling back to pure JS)?

As far as I can tell, there's no built-in way for jQuery to stream an HTTP request with JSON. Is that correct, or did I miss something? If this ability isn't built-in, has anyone already tackled this problem with a plugin or example?

Update: From what I can gather, HTML 5's support for WebSockets would likely be the best approach to achieve this. Unfortunately that means mainstream compatibility is still at least a few years out. As f开发者_JAVA百科ar as I know, these browser versions currently support WebSockets in some fashion:

  • WebKit 5 (Safari/Chrome)
  • Firefox 4
  • IE9 (Eventually)


HTML5 WebSockets would probably be the best choice.

It is possible to use WebSockets for modern browsers and Flash fallback for unsupported browsers.

This one supports alle browsers: http://jwebsocket.org/index.htm?page=browsers.htm

You can also try this on, but not tested on IE6: http://github.com/gimite/web-socket-js


This page might be of interest:

http://ajaxpatterns.org/HTTP_Streaming#Refactoring_Illustration

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜