WEBSOCKET API - 7TV DEVELOPERS
The WebSocket API has entered a stable phase and is now ready for consumption. However it should be noted it is uncomplete, and changes can and will occur. Clients implementing this API should do so knowing future updates may be breaking with short deprecation notice.
🌐 UPGRADE URL: wss://api.7tv.app/v2/ws
Connecting & Maintaining
Once connected, the server will immediately send an event with opcode 1 (HELLO). The event's payload contains heartbeat_interval, which is how often your client should send heartbeats.
Sending a heartbeat is done via opcode 2 (HEARTBEAT), which, if successful, the server will respond with 3 (HEARTBEAT_ACK) and continue to maintain the connection. The client is expected to continue sending heartbeats at interval until the client terminates its connection.
Subscribing
After connecting, the client can now subscribe to event channels. This is done by sending opcode 6 (SUBSCRIBE) with a payload containing type (int) and params (map).
Example:
{"op":6,"d":{"type":1,"params":{"channel":"vadikus007"}}}
The subscription is successful if the server did not disconnect the client. You cannot unsubscribe from an event channel without reconnecting at this time.
Full Documentation: https://github.com/SevenTV/ServerGo/blob/master/docs/websocket-api.md