EventSub WebSocket Monitor
Connect to Twitch's EventSub WebSocket gateway, log keepalive pings, and inspect notifications as they arrive. The client automatically handles reconnect and close events so you can focus on reacting to the payloads.
Get started
- Install dependencies with
npm installif you have not already. - Run
npx tsx examples/EVENTSUB_WEBSOCKET_MONITOR.tsto connect to the EventSub gateway. - Watch the console for the printed session ID. Supply that value when creating WebSocket subscriptions through the Helix API or Twitch CLI.
- Trigger events (such as going live or redeeming channel points) to see the payload logged to the console.
What you can do
- Observe EventSub session lifecycle events including reconnect requests and close codes.
- Monitor keepalive frequency to validate that your connection stays healthy.
- Log and inspect JSON payloads for subscriptions before wiring them into your production pipeline.
- Reuse the connected client inside your own application to fan out notifications.
Next steps
- Persist the session ID and reuse it across deployments to avoid creating duplicate subscriptions.
- Add reconnection metrics or alerting by reacting to the
reconnectandcloseevents. - Pair this listener with the Helix client to programmatically register subscriptions when the socket connects.