tweetstream / em-twitter

Twitter Streaming API client for EventMachine
http://rubygems.org/gems/em-twitter
MIT License
42 stars 16 forks source link

Better JSON validation #2

Closed stve closed 11 years ago

stve commented 12 years ago

Current response body validation for well-formed JSON is inherently flawed:

https://github.com/spagalloco/em-twitter/blob/master/lib/em-twitter/response.rb#L24-26

Consider parsing the response body and using successful parsing as the basis for valid responses.

stve commented 12 years ago

Looks like a better way to handle this is to use the delimiter argument: https://dev.twitter.com/docs/streaming-apis/processing#delimited

akonsu commented 11 years ago

@spagalloco I am using this to read from the firehose. For performance reasons I would prefer not to parse JSON response body, but instead redirect the body to external processes for processing. If you decide to implement JSON parsing, please consider having an option that would allow me to disable parsing.

stve commented 11 years ago

@akonsu thanks for the feedback. I'm going to dismiss the idea of parsing response bodies. The logic that's in place right now seems to be pretty solid and I'll handle issues with it if they come up.