I'm trying to use the Twitter Streaming API to collect data from Twitter.
below is my code in r
filterStream(oauth=my_oauth,
timeout = 0, track = keyword,
file.name = "tweets.json")
tweetsdf = parseTweets("tweets.json", simplify = TRUE)
View(tweetsdf)
You can see that i have set the timeout to 0 which should mean that the connection is always on. but what i'm finding is that my connection is dropped after just under 3 hours.
You are going to want the connection to timeout because Twitter will drop the connection when there is no activity after 90 seconds. Put your code inside a
try
block inside awhile
loop. That way you can reconnect when your connection drops.