A Node.js TweetStream client opens a WebSocket with API-key subprotocol auth, parses JSON envelopes, and reconnects safely.
Connection details
Keep the API key in environment variables and connect from a server process.
wss://ws-global.tweetstream.io/wstweetstream.v1tweetstream.auth.token.<API_KEY>
Reconnect strategy
Production clients should treat reconnects as normal. Keep event handling idempotent and make sure duplicate messages do not trigger duplicate trades or alerts.
Questions
How do I connect from Node.js?
tweetstream.v1 and tweetstream.auth.token.<API_KEY> as subprotocols, then parse JSON messages.