Connect to any TikTok Live stream and receive real-time events in C#. No signing server, no API keys, no authentication required.
// Connect to a live stream — auth and room resolution handled internally
var client = new TikTokLiveClient("username_here");
// Subscribe to events — each carries fully decoded protobuf data
client.OnChat += msg =>
Console.WriteLine($"[chat] {msg.User?.Nickname}: {msg.Content}");
client.OnGift += msg =>
Console.WriteLine($"[gift] {msg.User?.Nickname} sent {msg.Gift?.Name} x{msg.RepeatCount} ({msg.Gift?.DiamondCount} diamonds)");
client.OnLike += msg =>
Console.WriteLine($"[like] {msg.User?.Nickname} ({msg.TotalLikes} total)");
// Blocks until disconnected — handles heartbeat and reconnection automatically
await client.RunAsync();dotnet add package PirateTok.Live
Targets netstandard2.0 — works with .NET 6+, .NET Framework 4.6.1+, Unity 2021+.
| Language | Install | Repo |
|---|---|---|
| Rust | cargo add piratetok-live-rs |
live-rs |
| Go | go get github.com/PirateTok/live-go |
live-go |
| Python | pip install piratetok-live-py |
live-py |
| JavaScript | npm install piratetok-live-js |
live-js |
| Java | com.piratetok:live |
live-java |
| Lua | luarocks install piratetok-live-lua |
live-lua |
| Elixir | {:piratetok_live, "~> 0.1"} |
live-ex |
| Dart | dart pub add piratetok_live |
live-dart |
| C | #include "piratetok.h" |
live-c |
| PowerShell | Install-Module PirateTok.Live |
live-ps1 |
| Shell | bpkg install PirateTok/live-sh |
live-sh |
- Zero signing dependency — no API keys, no signing server, no external auth
- 64 decoded event types — chat, gifts, likes, joins, follows, shares, battles, polls, and more
- Auto-reconnection — stale detection, exponential backoff, self-healing auth
- Enriched User data — badges, gifter level, moderator status, follow info, fan club
- Sub-routed convenience events —
OnFollow,OnShare,OnJoin,OnLiveEnded
var client = new TikTokLiveClient("username_here")
.CdnEU()
.Timeout(TimeSpan.FromSeconds(15))
.MaxRetries(10)
.StaleTimeout(TimeSpan.FromSeconds(90));// Normal rooms
var info = await TikTokLiveClient.FetchRoomInfoAsync(
"ROOM_ID",
TimeSpan.FromSeconds(10));
// 18+ rooms — pass session cookies from browser DevTools
var info = await TikTokLiveClient.FetchRoomInfoAsync(
"ROOM_ID",
TimeSpan.FromSeconds(10),
cookies: "sessionid=abc; sid_tt=abc");- Resolves username to room ID via TikTok JSON API
- Authenticates and opens a direct WSS connection
- Protobuf heartbeats every 10s
- Decodes protobuf stream into typed C# objects via protobuf-net
- Auto-reconnects on stale/dropped connections with fresh credentials
dotnet run --project examples/BasicChat -- <username> # connect + print chat events
dotnet run --project examples/OnlineCheck -- <username> # check if user is live
dotnet run --project examples/StreamInfo -- <username> # fetch room metadata + stream URLs
dotnet run --project examples/GiftTracker -- <username> # track gifts with diamond totalsProxy(...)exists on the client surface, but proxy transport plumbing is not wired intoHttpClientorClientWebSocketyet.- Explicit
DEVICE_BLOCKEDhandshake handling is not implemented yet.
0BSD
