Twitter + HTML5 webSocket API [英] Twitter + HTML5 webSocket API
问题描述
有没有办法通过HTML5 webSocket API(JavaScript)连接到Twitter?
Is there a way of connecting to Twitter through the HTML5 webSocket API (JavaScript)?
目前 http://streamie.org/ 似乎正在做类似的事情,但他们正在通过 http:// local引领它.streamie.org:8888 / 所以看起来他们正在运行websocket。
Currently http://streamie.org/ seems to be doing something like that but they are leading it through http://local.streamie.org:8888/ so it looks like they are running the websocket.
JavaScript部分很清楚:
The JavaScript part is quite clear:
websocket = new WebSocket('ws://echo.websocket.org/');
websocket.onopen = function(event) {
websocket.send('hello from client');
console.log('CONNECTED');
};
websocket.onclose = function(event) {
console.log('DISCONNECTED');
};
websocket.onmessage = function(event) {
console.log(event.data);
};
websocket.onerror = function(event) {
};
但Twitter的websocket地址是什么?
But what's the websocket address for Twitter?
推荐答案
Twitter不提供WebSocket接口。如果要通过WebSockets访问Twitter Streaming API,则必须在自己的服务器上运行代理。
Twitter does not provide a WebSocket interface. You will have to run a proxy on your own server if you want to access the Twitter Streaming API through WebSockets.
这篇关于Twitter + HTML5 webSocket API的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!