Event Types

Understanding the event types and message schemas received from the Euler Stream WebSocket server.

The WebSocket server streams real-time TikTok LIVE events. The first message is always room info, followed by a continuous stream of live events.

Room Info (First Message)

The first message after connection contains the room info payload. Use this to access:

  • Creator profile picture and display name
  • Room ID
  • Stream status and metadata
  • Viewer count

Message Format

Messages are sent as binary protobuf-encoded data. The WebSocket SDK provides utilities to decode them:

import WebSocket from "ws";
 
const ws = new WebSocket(
  `wss://ws.eulerstream.com?uniqueId=tv_asahi_news&apiKey=${process.env.EULER_API_KEY}`
);
 
ws.on("message", (data: Buffer) => {
  // Messages are protobuf-encoded
  // Use the SDK's decode utilities or the tiktok-live-connector types
  console.log("Received message, length:", data.length);
});

Common Event Types

The WebSocket server forwards all TikTok LIVE events. Common event types include:

EventDescription
ChatText messages from viewers
GiftGifts sent to the creator
LikeLikes (hearts) from viewers
MemberUser joined the livestream
ShareUser shared the livestream
FollowUser followed the creator
SubscribeUser subscribed to the creator
RoomUpdateRoom metadata changes (viewer count, etc.)
StreamEndThe livestream has ended

TypeScript Types

Install the WebSocket SDK for full TypeScript definitions of all event schemas:

import type { ... } from "@eulerstream/euler-websocket-sdk";

For the complete schema definitions, see the source on GitHub.

Types for Non-JavaScript Clients

If you're not using JavaScript/TypeScript, you can reference the protobuf schema definitions directly:

https://github.com/EulerStream/Euler-WebSocket-SDK/tree/master/src/webcast/schemas

These schemas define the exact structure of every message type. You can use them to generate types in any language that supports protobuf.

Bonus: Stream Video

If you want to serve the TikTok LIVE stream video, call the /webcast/room_video endpoint with the uniqueId of the creator. This returns stream video data you can embed or process.