adamwynne / twitter-api

Async io interface to all the twitter APIs
372 stars 64 forks source link

java.io.EOFException: JSON error #7

Closed treseder closed 12 years ago

treseder commented 12 years ago

I'm using code straight from the streaming examples, except I'm filtering on a particular user (oath code not shown):

(def ^:dynamic *custom-streaming-callback* 
  (AsyncStreamingCallback. (comp println #(:text %) json/read-json #(str %2)) 
                           (comp println response-return-everything)
                           exception-print))

(defn start-filtering []
  (statuses-filter :params {:follow 12345}
                            :oauth-creds *creds*
                            :callbacks *custom-streaming-callback*))

When I call the start-filtering method all goes well initially, but if the stream is inactive for a bit (around 30 seconds), i.e. no tweets about this particular user are coming down the pike, the following error occurs:

#<EOFException java.io.EOFException: JSON error (end-of-file)>

I assumed that twitter would keep the stream open indefinitely. I'm looking through the twitter-api code to see what I'm missing, but I thought I'd post here to see if anyone else has seen this exception before.

adamwynne commented 12 years ago

Sorry, just noticed this is still open. I think it's because the twitter servers send CR's every 30s which would confuse the json/read-string and make it throw