Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Twitter streaming API example twitter-node and
<title>Codesnippit NodeJS Twitter Tracker Client</title>
(function() {
var script = document.createElement("script");
script.src = "";
script.onload = function() {
$.getScript("http://localhost:3000/", function() {
var socket = new io.Socket("localhost", {"port": 3000});
socket.on("message", function(json) {
data = JSON.parse(json);
$("<li></li>").text("@" + data.user.screen_name + " " + data.text).prependTo("ul");
var http = require('http');
var config = {
user: "",
password: "",
track: ["ipl"]},
sys = require('sys');
server = http.createServer(function(req, res) { // create the server
res.writeHead(200, {'Content-Type': 'text/html'});
res.end('<h1>Codesnippit Twitter Tracker Server is <span style="color: #bada55">operational</span></h1>');
var socket = require('').listen(server),
twitter = new (require("twitter-node").TwitterNode)(config);
.addListener('error', function(error){ // Always check for errors or they popup client side
.addListener('tweet', function(tweet){ // A new tweet that matches the criteria has been located
.addListener('limit', function(limit){ // New limit has been sent from the API
sys.puts('LIMIT: ' + sys.inspect(limit));
.addListener('delete', function(del){ // A delete event occured
sys.puts('DELETE: ' + sys.inspect(del));
.addListener('end', function(resp){ // API disconnect
sys.puts('wave goodbye...' + resp.statusCode);

This comment has been minimized.

Copy link

@mrsteveheyes mrsteveheyes commented Aug 26, 2011

Hi, I cam across this and it looks awesome. I tried to get it working and I came across this error :

TwitterNode parser error: Object #<Manager> has no method 'broadcast'

Any thoughts on what it could be?



This comment has been minimized.

Copy link

@petermk petermk commented Mar 24, 2012

It's socket.emit, not socket.broadcast

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment