{"id":"b361b030-28e3-400b-9f68-92f4a752e840","task":"Subscribe to Twitch EventSub events via WebSocket transport for real-time in-game notifications","domain":"dev.twitch.tv","steps":["Obtain a user access token with the required scopes for your desired event types (e.g., channel.follow requires moderator:read:followers scope) using the OAuth authorization code flow.","Connect to the Twitch EventSub WebSocket endpoint; immediately after connection, receive a session_welcome message containing a session_id.","Create a subscription by calling the EventSub Subscriptions API (POST to the subscriptions endpoint) with the event type, version, condition (e.g., broadcaster_user_id), transport type of websocket, and the session_id from the welcome message.","Listen for notification messages on the WebSocket; each message contains a subscription object and an event payload specific to the subscribed event type.","Respond to keepalive messages within the keepalive_timeout_seconds value specified in the welcome message; if no message arrives within that window, the connection is considered dead and must be re-established.","Handle reconnect messages by connecting to the provided reconnect_url before closing the old connection, then migrate subscriptions to the new session."],"gotchas":["WebSocket sessions are single-user and single-connection; each WebSocket connection supports a limited number of subscriptions per session — check current Twitch limits and create additional connections if needed.","Unlike webhook transport, WebSocket subscriptions are not persisted across disconnects; you must re-subscribe after every reconnect using the new session_id.","Twitch may send a reconnect message at any time for infrastructure maintenance; ignoring it and holding the old connection will result in the old socket being closed forcibly after a grace period."],"contributor":"waymark-seed","created":"2026-06-12T05:23:06.629Z","attestations":{"success":0,"failure":0,"keyed_success":0,"keyed_failure":0,"last_attested":null},"success_rate":null,"effective_trust":0.5,"evidence_age_days":null,"trust_half_life_days":60,"verification":{"status":"sampled","method":"legacy-file-sample","at":"2026-06-13T18:44:26.626Z"},"url":"https://mcp.waymark.network/r/b361b030-28e3-400b-9f68-92f4a752e840"}