FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
twstreamer/README at master · r/twstreamer · GitHub
r
/
twstreamer
Public
Notifications
You must be signed in to change notification settings
Fork
10
Star
34
Code
Issues
12
Pull requests
0
Actions
Projects
Wiki
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Wiki
Security and quality
Insights
Expand file tree
Breadcrumbs
twstreamer
/
README
Copy path
More file actions
More file actions
Latest commit
History
History
History
63 lines (49 loc) · 2.12 KB
Breadcrumbs
twstreamer
/
README
Copy path
File metadata and controls
63 lines (49 loc) · 2.12 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
+------------+
| twStreamer |
+------------+
Because we don't (yet) support Web Sockets on the Twitter Streaming API
(http://apiwiki.twitter.com/Streaming-API-Documentation), the only method
available to connect to the Streaming API from Javascript is to rely on a
Flash intermediary. This library provides a very small SWF (2K when compiled),
that will connect to the Streaming API and then call back out to JavaScript
with the JSON status object once it is received.
This library is only, currently, suitable for proof of concept scenarios.
+-----------------+
| Getting Started |
+-----------------+
This library depends on both jQuery 1.4.2 (http://jquery.com/) and jQuery SWF
Object (http://jquery.thewikies.com/swfobject/). With those, the twstreamer.js
and TwStreamFlash.swf files in the same directory, and the JS scripts included
via script tags, it is as simple as
// set up the connection
jQuery.twstreamer
.init()
.credentials(USERNAME, PASSWORD)
.connect(
function(tweet) { // callback function
// receive tweet
console.log(tweet);
},
'track', // api method (track, follow, etc.)
'twitter', // api query
'betastream.twitter.com' // the host to connect to (optional)
);
// good housekeeping, once the connection can be closed
jQuery.twstreamer.disconnect();
At this time, the Streaming API still uses basic auth, so the call to
credentials(USERNAME, PASSWORD)
requires basic auth credentials to connect. Once the credentials have
been supplied
connect(handler, method, query, host)
will actually initiate the connect and begin to proxy Tweets. The "handler"
needs to take a single jQuery parsed JSON object as an argument -- that is the
actual Tweet.
The host to connect to is optional, but at this time, stream.twitter.com, the
default Streaming API endpoint, does not serve a crossdomain.xml file. Only
the betastream.twitter.com does.
+--------------+
| Contributors |
+--------------+
Raffi Krikorian <raffi@twitter.com>
Russell D'Sa <dsa@twitter.com>
Premasagar Rose <p@premasagar.com>
Back
|
FazBrowse Home
|
New Git URL