Skip to content

Conversation

@tremby
Copy link

@tremby tremby commented Oct 14, 2018

I'm frequently seeing incoming messages with multiple tweets. With the current version these emit a 'data error' event, with a SyntaxError (Unexpected token { in JSON at position n).

This patch adds a small module I just wrote as a dependency, which handles multiple objects in a single input string. This is then run on incoming JSON. Each recovered object is then emitted in a separate 'message' event.

I'm frequently seeing incoming messages with multiple tweets. With the
current version these emit a 'data error' event, with a SyntaxError
(Unexpected token { in JSON at position n).

This patch adds a small module I just wrote as a dependency, which
handles multiple objects in a single input string. This is then run on
incoming JSON. Each recovered object is then emitted in a separate
'message' event.
@tremby
Copy link
Author

tremby commented Oct 14, 2018

If anyone needs this before it's merged, I've published it as @tremby/twitter-stream-api.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant