Quick Start
This guide shows the shortest path to connect a local client to LIVE Studio Local Data Access.
Prerequisites
- LIVE Studio is running on the same machine.
- Local data access is enabled for the current environment.
- You have an issued
app_id,key_id, andsecret. - Your client can open a WebSocket connection to
127.0.0.1.
Keep the secret private
Do not print, persist, or upload the raw secret. It is only used locally to authenticate the client.
1. Scan the local ports
LIVE Studio binds one port in the reserved range:
127.0.0.1:30000-30015Try each candidate endpoint until one returns a valid SERVER_HELLO:
ws://127.0.0.1:{port}/v1/third-partyClose the candidate connection and continue scanning when:
- The connection fails.
- The connection times out.
- The first message is not a valid
SERVER_HELLO. - The
product,channel, orversiondoes not match this protocol.
2. Validate SERVER_HELLO
The server sends SERVER_HELLO immediately after the WebSocket opens:
{
"type": "SERVER_HELLO",
"product": "tiktok_live_studio",
"channel": "third-party-im",
"version": "1.0.0"
}Only send credentials after this message has been validated.
3. Send AUTH
The first client JSON message must be AUTH.
{
"type": "AUTH",
"app_id": "your_app_id",
"key_id": "your_key_id",
"secret": "your_secret",
"version": "1.0.0"
}The server waits up to 20 seconds for a valid authentication message.
4. Handle AUTH_RESULT
When authentication succeeds:
{
"type": "AUTH_RESULT",
"success": true,
"app_id": "your_app_id",
"app_name": "Example App",
"message": "Authentication successful",
"server_time": 1786010400000,
"version": "1.0.0"
}After this point, the connection can receive EVENT messages.
When authentication fails, inspect error_code and stop using that connection.
5. Listen for events
{
"type": "EVENT",
"event": "live.chat",
"timestamp": 1786010400000,
"payload": {
"message_id": "7520000000000000002",
"room_id": "7520000000000000000",
"content": "hello live"
}
}Use message_id for deduplication when available.
6. Reconnect safely
When the socket closes, start from service discovery again. A new WebSocket connection must repeat SERVER_HELLO validation and AUTH.