Last active
November 3, 2016 16:03
-
-
Save xream/b404395342dc41b62cfe0a3a2552c51d to your computer and use it in GitHub Desktop.
reactive programming with the Twitter streaming API
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const conf = require('./conf').twit; | |
const Twit = require('twit') | |
const Rx = require('rxjs/Rx') | |
const subject = new Rx.Subject() | |
.map(({ | |
text, | |
user: { | |
screen_name | |
} | |
}) => `@${screen_name}: ${text}`) | |
subject.subscribe({ | |
next: v => console.log('next: ' + v), | |
error: v => console.log('error: ' + v), | |
complete: () => console.log('complete'), | |
}) | |
new Twit(conf) | |
.stream('user') | |
.on('tweet', e => subject.next(e)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment