tiktok-live-api 1.2.19 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -18,6 +18,54 @@
18
18
 
19
19
  > This package is **not affiliated with or endorsed by TikTok**. It connects to the [TikTool Live](https://tik.tools) managed API service — 99.9% uptime, no reverse engineering, no maintenance required. Also available for [Python](https://pypi.org/project/tiktok-live-api/) and [any language via WebSocket](https://tik.tools/docs).
20
20
 
21
+ ---
22
+
23
+ ## 🔄 Migrating from TikTok-Live-Connector?
24
+
25
+ **One import, zero code changes.** If you use `tiktok-live-connector`, switch to the managed TikTools API in seconds:
26
+
27
+ ### Step 1: Install
28
+
29
+ ```bash
30
+ npm install tiktok-live-api
31
+ ```
32
+
33
+ ### Step 2: Change one line
34
+
35
+ ```diff
36
+ - const { WebcastPushConnection } = require('tiktok-live-connector');
37
+ + const { WebcastPushConnection } = require('tiktok-live-api');
38
+ ```
39
+
40
+ ### Step 3: Replace your Euler key with a TikTools key
41
+
42
+ ```diff
43
+ const connection = new WebcastPushConnection('username', {
44
+ - signApiKey: 'EULER_API_KEY',
45
+ + signApiKey: 'TIKTOOL_API_KEY', // Get free at tik.tools
46
+ });
47
+ ```
48
+
49
+ **That's it.** All your existing event handlers (`chat`, `gift`, `member`, `roomUser`, `like`, `follow`, `share`, `emote`, `linkMicBattle`, `linkMicArmies`, `questionNew`, etc.) work identically. `getState()`, `connect()`, `disconnect()` — all the same.
50
+
51
+ <details>
52
+ <summary><strong>Why switch?</strong></summary>
53
+
54
+ | | tiktok-live-api | tiktok-live-connector |
55
+ |---|---|---|
56
+ | **Stability** | ✓ Managed API, 99.9% uptime | ✗ Breaks on TikTok updates |
57
+ | **Maintenance** | ✓ Zero — we handle it | ✗ You fix breakages |
58
+ | **CAPTCHA Solving** | ✓ Built-in (Pro+) | ✗ |
59
+ | **Live Captions** | ✓ AI speech-to-text | ✗ |
60
+ | **Translation** | ✓ Real-time, 50+ languages | ✗ |
61
+ | **Feed Discovery** | ✓ See who's live | ✗ |
62
+ | **TypeScript** | ✓ First-class, fully typed | Partial |
63
+ | **Free Tier** | ✓ 50 requests/day | ✓ Free (unreliable) |
64
+
65
+ </details>
66
+
67
+ ---
68
+
21
69
  ## 🚀 One-Command Quick Start
22
70
 
23
71
  Instantly connect to a live TikTok stream and print real-time events to your terminal. No signup, no install:
@@ -190,6 +238,8 @@ client.connect();
190
238
 
191
239
  ## Events
192
240
 
241
+ ### Stream Events
242
+
193
243
  | Event | Description | Key Fields |
194
244
  |-------|-------------|------------|
195
245
  | `chat` | Chat message | `user`, `comment`, `emotes`, `starred?` |
@@ -201,90 +251,57 @@ client.connect();
201
251
  | `subscribe` | New subscriber | `user` |
202
252
  | `roomUserSeq` | Viewer count | `viewerCount`, `topViewers` |
203
253
  | `battle` | Battle event | `type`, `teams`, `scores` |
254
+ | `battleArmies` | Battle teams | `teams` |
204
255
  | `roomPin` | Pinned/starred message | `user`, `comment`, `action`, `durationSeconds` |
205
256
  | `envelope` | Treasure chest | `diamonds`, `user` |
257
+ | `emoteChat` | Emote in chat | `user`, `emoteId`, `emoteUrl` |
258
+ | `question` | Q&A question | `user`, `questionText` |
259
+ | `liveIntro` | Stream intro | `title` |
260
+ | `rankUpdate` | Rank update | `rankType` |
261
+ | `control` | Stream control | `action` |
262
+ | `superFan` | Someone became Super Fan | `user`, `level`, `displayType` |
263
+ | `superFanJoin` | Super Fan joined chat | `user`, `displayType` |
264
+ | `superFanBox` | Super Fan Box gift | `user`, `diamondCount` |
265
+ | `barrage` | Raw barrage signal | `user`, `label`, `displayType`, `content` |
206
266
  | `streamEnd` | Stream ended | `reason` |
207
- | `connected` | Connected | `uniqueId` |
208
- | `disconnected` | Disconnected | `uniqueId` |
209
- | `error` | Error occurred | `error` |
210
- | `event` | Catch-all | Full raw event |
211
-
212
- All events are fully typed with TypeScript interfaces. Your IDE will show autocompletion for every field.
213
267
 
214
- ## Live Captions (Speech-to-Text)
268
+ ### TTLC-Compatible Aliases
215
269
 
216
- Transcribe and translate any TikTok LIVE stream in real-time. **This feature is unique to TikTool Live no other TikTok library offers it.**
217
-
218
- ```typescript
219
- import { TikTokCaptions } from 'tiktok-live-api';
220
-
221
- <<<<<<< HEAD
222
- live.on('event', (event) => {
223
- console.log(event.type, event);
224
- });
225
- ```
270
+ These aliases ensure 100% compatibility with TikTok-Live-Connector event names:
226
271
 
227
- ### Reference
228
-
229
- | Event | Type | Description | Fields |
230
- |-------|------|-------------|--------|
231
- | `chat` | `ChatEvent` | Chat message | `user`, `comment`, `starred?` |
232
- | `member` | `MemberEvent` | User joined | `user`, `action` |
233
- | `like` | `LikeEvent` | User liked | `user`, `likeCount`, `totalLikes` |
234
- | `gift` | `GiftEvent` | Gift sent | `user`, `giftName`, `diamondCount`, `repeatCount`, `combo` |
235
- | `social` | `SocialEvent` | Follow / Share | `user`, `action` |
236
- | `roomUserSeq` | `RoomUserSeqEvent` | Viewer count | `viewerCount`, `totalViewers` |
237
- | `battle` | `BattleEvent` | Link Mic battle | `status` |
238
- | `battleArmies` | `BattleArmiesEvent` | Battle teams | — |
239
- | `subscribe` | `SubscribeEvent` | New subscriber | `user`, `subMonth` |
240
- | `emoteChat` | `EmoteChatEvent` | Emote in chat | `user`, `emoteId` |
241
- | `envelope` | `EnvelopeEvent` | Treasure chest | `diamondCount` |
242
- | `question` | `QuestionEvent` | Q&A question | `user`, `questionText` |
243
- | `control` | `ControlEvent` | Stream control | `action` (3 = ended) |
244
- | `room` | `RoomEvent` | Room status | `status` |
245
- | `liveIntro` | `LiveIntroEvent` | Stream intro | `title` |
246
- | `rankUpdate` | `RankUpdateEvent` | Rank update | `rankType` |
247
- | `linkMic` | `LinkMicEvent` | Link Mic | `action` |
248
- | `roomPin` | `RoomPinEvent` | Pinned/starred message | `user`, `comment`, `action`, `durationSeconds` |
249
- | `unknown` | `UnknownEvent` | Unrecognized | `method` |
272
+ | TTLC Name | Maps To | Notes |
273
+ |-----------|---------|-------|
274
+ | `roomUser` | `roomUserSeq` | Both fire simultaneously |
275
+ | `questionNew` | `question` | Both fire simultaneously |
276
+ | `linkMicBattle` | `battle` | Both fire simultaneously |
277
+ | `linkMicArmies` | `battleArmies` | Both fire simultaneously |
278
+ | `emote` | `emoteChat` | Both fire simultaneously |
250
279
 
251
280
  ### Connection Events
252
281
 
253
- | Event | Callback | Description |
254
- |-------|----------|-------------|
255
- | `connected` | `() => void` | Connected to stream |
256
- | `disconnected` | `(code, reason) => void` | Disconnected |
257
- | `roomInfo` | `(info: RoomInfo) => void` | Room info |
258
- | `error` | `(error: Error) => void` | Error |
282
+ | Event | Description |
283
+ |-------|-------------|
284
+ | `connected` | Connected to stream |
285
+ | `disconnected` | Disconnected |
286
+ | `error` | Error occurred |
287
+ | `event` | Catch-all (full raw payload) |
288
+ | `rawData` | Same as `event` (TTLC compat) |
289
+ | `decodedData` | Same as `event` (TTLC compat) |
290
+ | `websocketConnected` | WebSocket connected (TTLC compat) |
259
291
 
260
- ---
292
+ All events are fully typed with TypeScript interfaces. Your IDE will show autocompletion for every field.
261
293
 
262
294
  ## 🎤 Real-Time Live Captions
263
295
 
264
- AI-powered speech-to-text transcription and translation for TikTok LIVE streams. Features include:
265
-
266
- - **Auto-detect language** — Automatically identifies the spoken language
267
- - **Speaker diarization** — Identifies individual speakers in multi-person streams
268
- - **Real-time translation** — Translate to any supported language with sub-second latency
269
- - **Partial + final results** — Get streaming partial transcripts and confirmed final text
270
- - **Credit-based billing** — 1 credit = 1 minute of transcription/translation
271
-
272
- ### Quick Start
296
+ AI-powered speech-to-text transcription and translation for TikTok LIVE streams. **This feature is unique to TikTool Live — no other TikTok library offers it.**
273
297
 
274
298
  ```typescript
275
- import { TikTokCaptions } from '@tiktool/live';
276
-
277
- const captions = new TikTokCaptions({
278
- uniqueId: 'streamer_name',
279
- apiKey: 'YOUR_API_KEY',
280
- translate: 'en',
281
- diarization: true,
282
- =======
299
+ import { TikTokCaptions } from 'tiktok-live-api';
300
+
283
301
  const captions = new TikTokCaptions('streamer_username', {
284
302
  apiKey: 'YOUR_API_KEY',
285
303
  translate: 'en', // translate to English
286
304
  diarization: true, // identify who is speaking
287
- >>>>>>> ac7990ac0be77c4206d9d8fa0bccbe1c85a2bbe6
288
305
  });
289
306
 
290
307
  captions.on('caption', (event) => {
@@ -378,6 +395,7 @@ client.on('gift', (event: GiftEvent) => {
378
395
  | Option | Type | Default | Description |
379
396
  |--------|------|---------|-------------|
380
397
  | `apiKey` | `string` | `process.env.TIKTOOL_API_KEY` | Your TikTool API key |
398
+ | `signApiKey` | `string` | — | Alias for `apiKey` (TTLC compat) |
381
399
  | `autoReconnect` | `boolean` | `true` | Auto-reconnect on disconnect |
382
400
  | `maxReconnectAttempts` | `number` | `5` | Max reconnection attempts |
383
401
 
@@ -388,6 +406,15 @@ client.on('gift', (event: GiftEvent) => {
388
406
  - `client.disconnect()` — Disconnect from stream
389
407
  - `client.connected` — Whether currently connected
390
408
  - `client.eventCount` — Total events received
409
+ - `client.getState()` — Get connection state (TTLC compat)
410
+ - `client.getRoomInfo()` — Get room info (TTLC compat)
411
+
412
+ ### `new WebcastPushConnection(uniqueId, options?)`
413
+
414
+ Drop-in replacement for TikTok-Live-Connector. See [Migration Guide](#-migrating-from-tiktok-live-connector).
415
+
416
+ All `TikTokLive` options are supported, plus TTLC-specific options that are accepted silently:
417
+ `processInitialData`, `fetchRoomInfoOnConnect`, `enableExtendedGiftInfo`, `enableWebsocketUpgrade`, `sessionId`, `clientParams`, `requestHeaders`, `websocketHeaders`, `signProviderOptions`.
391
418
 
392
419
  ### `new TikTokCaptions(uniqueId, options?)`
393
420
 
@@ -438,6 +465,7 @@ client.on('gift', (event: GiftEvent) => {
438
465
 
439
466
  - 🌐 **Website**: [tik.tools](https://tik.tools)
440
467
  - 📖 **Documentation**: [tik.tools/docs](https://tik.tools/docs)
468
+ - 🔄 **Migration Guide**: [tik.tools/migrate](https://tik.tools/migrate)
441
469
  - 🐍 **Python SDK**: [pypi.org/project/tiktok-live-api](https://pypi.org/project/tiktok-live-api/)
442
470
  - 💻 **GitHub**: [github.com/tiktool/tiktok-live-api](https://github.com/tiktool/tiktok-live-api)
443
471
 
package/dist/index.d.mts CHANGED
@@ -1,3 +1,5 @@
1
+ import WebSocket from 'ws';
2
+
1
3
  /**
2
4
  * Type definitions for TikTok LIVE API events.
3
5
  *
@@ -54,12 +56,12 @@ interface SocialEvent {
54
56
  user: TikTokUser;
55
57
  eventType: string;
56
58
  }
57
- /** Payload for `roomUserSeq` (viewer count) events. */
59
+ /** Payload for `roomUserSeq` / `roomUser` (viewer count) events. */
58
60
  interface RoomUserSeqEvent {
59
61
  viewerCount: number;
60
62
  topViewers: TikTokUser[];
61
63
  }
62
- /** Payload for `battle` events. */
64
+ /** Payload for `battle` / `linkMicBattle` events. */
63
65
  interface BattleEvent {
64
66
  type: string;
65
67
  teams: Array<Record<string, unknown>>;
@@ -84,6 +86,60 @@ interface RoomPinEvent {
84
86
  /** User ID of the operator who pinned the message. */
85
87
  operatorUserId: string;
86
88
  }
89
+ /** Payload for `superFan` events. */
90
+ interface SuperFanEvent {
91
+ user: TikTokUser;
92
+ level: number;
93
+ displayType: string;
94
+ }
95
+ /** Payload for `superFanJoin` events. */
96
+ interface SuperFanJoinEvent {
97
+ user: TikTokUser;
98
+ displayType: string;
99
+ }
100
+ /** Payload for `superFanBox` events. */
101
+ interface SuperFanBoxEvent {
102
+ user: TikTokUser;
103
+ envelopeId: string;
104
+ diamondCount: number;
105
+ }
106
+ /** Payload for `barrage` events. */
107
+ interface BarrageEvent {
108
+ user: TikTokUser;
109
+ label: string;
110
+ displayType: string;
111
+ content: string;
112
+ }
113
+ /** Payload for `emoteChat` / `emote` events. */
114
+ interface EmoteChatEvent {
115
+ user: TikTokUser;
116
+ emoteId: string;
117
+ emoteUrl: string;
118
+ }
119
+ /** Payload for `question` / `questionNew` events. */
120
+ interface QuestionEvent {
121
+ user: TikTokUser;
122
+ questionText: string;
123
+ }
124
+ /** Payload for `control` events. */
125
+ interface ControlEvent {
126
+ action: number;
127
+ }
128
+ /** Payload for `liveIntro` events. */
129
+ interface LiveIntroEvent {
130
+ title: string;
131
+ [key: string]: unknown;
132
+ }
133
+ /** Payload for `rankUpdate` events. */
134
+ interface RankUpdateEvent {
135
+ rankType: string;
136
+ [key: string]: unknown;
137
+ }
138
+ /** Payload for `linkMic` events. */
139
+ interface LinkMicEvent {
140
+ action: string;
141
+ [key: string]: unknown;
142
+ }
87
143
  /** Payload for `caption` events from {@link TikTokCaptions}. */
88
144
  interface CaptionEvent {
89
145
  text: string;
@@ -117,6 +173,8 @@ interface ErrorEvent {
117
173
  }
118
174
  /**
119
175
  * Map of event names to their payload types for {@link TikTokLive}.
176
+ *
177
+ * Includes native TikTools events and TTLC-compatible aliases.
120
178
  */
121
179
  interface TikTokLiveEventMap {
122
180
  chat: ChatEvent;
@@ -126,16 +184,47 @@ interface TikTokLiveEventMap {
126
184
  share: SocialEvent;
127
185
  member: MemberEvent;
128
186
  subscribe: SocialEvent;
187
+ social: SocialEvent;
129
188
  roomUserSeq: RoomUserSeqEvent;
130
189
  battle: BattleEvent;
131
190
  roomPin: RoomPinEvent;
132
191
  envelope: Record<string, unknown>;
133
192
  streamEnd: Record<string, unknown>;
134
193
  roomInfo: Record<string, unknown>;
194
+ emoteChat: EmoteChatEvent;
195
+ question: QuestionEvent;
196
+ control: ControlEvent;
197
+ liveIntro: LiveIntroEvent;
198
+ rankUpdate: RankUpdateEvent;
199
+ linkMic: LinkMicEvent;
200
+ battleArmies: Record<string, unknown>;
201
+ room: Record<string, unknown>;
202
+ unknown: Record<string, unknown>;
203
+ superFan: SuperFanEvent;
204
+ superFanJoin: SuperFanJoinEvent;
205
+ superFanBox: SuperFanBoxEvent;
206
+ barrage: BarrageEvent;
207
+ /** @alias roomUserSeq */
208
+ roomUser: RoomUserSeqEvent;
209
+ /** @alias question */
210
+ questionNew: QuestionEvent;
211
+ /** @alias battle */
212
+ linkMicBattle: BattleEvent;
213
+ /** @alias battleArmies */
214
+ linkMicArmies: Record<string, unknown>;
215
+ /** @alias emoteChat */
216
+ emote: EmoteChatEvent;
135
217
  connected: ConnectedEvent;
136
218
  disconnected: DisconnectedEvent;
137
219
  error: ErrorEvent;
220
+ /** Catch-all: fires for every incoming event with full raw payload. */
138
221
  event: Record<string, unknown>;
222
+ /** rawData: fires for every event (TTLC compat). Same as `event`. */
223
+ rawData: Record<string, unknown>;
224
+ /** decodedData: fires for every event (TTLC compat). Same as `event`. */
225
+ decodedData: Record<string, unknown>;
226
+ /** websocketConnected: fires when WS connects (TTLC compat). */
227
+ websocketConnected: Record<string, unknown>;
139
228
  }
140
229
  /**
141
230
  * Map of event names to their payload types for {@link TikTokCaptions}.
@@ -177,10 +266,28 @@ interface TikTokCaptionsEventMap {
177
266
  interface TikTokLiveOptions {
178
267
  /** Your TikTool API key. Get one free at https://tik.tools */
179
268
  apiKey?: string;
269
+ /**
270
+ * Euler Stream API key — for users migrating from TikTok-Live-Connector.
271
+ * If provided and `apiKey` is not set, this is used as the API key.
272
+ * @alias apiKey
273
+ */
274
+ signApiKey?: string;
180
275
  /** Auto-reconnect on disconnect (default: true). */
181
276
  autoReconnect?: boolean;
182
277
  /** Max reconnection attempts (default: 5). */
183
278
  maxReconnectAttempts?: number;
279
+ /** @deprecated Handled server-side. Accepted for TTLC compatibility. */
280
+ processInitialData?: boolean;
281
+ /** @deprecated Handled server-side. Accepted for TTLC compatibility. */
282
+ fetchRoomInfoOnConnect?: boolean;
283
+ /** @deprecated Always enabled server-side. Accepted for TTLC compatibility. */
284
+ enableExtendedGiftInfo?: boolean;
285
+ /** @deprecated Accepted for TTLC compatibility. */
286
+ enableWebsocketUpgrade?: boolean;
287
+ /** @deprecated Accepted for TTLC compatibility. */
288
+ requestPollingIntervalMs?: number;
289
+ /** TikTok session ID for authenticated features. */
290
+ sessionId?: string;
184
291
  }
185
292
  type EventHandler$1<T> = (data: T) => void | Promise<void>;
186
293
  /**
@@ -203,12 +310,14 @@ declare class TikTokLive {
203
310
  readonly autoReconnect: boolean;
204
311
  /** Maximum reconnection attempts. */
205
312
  readonly maxReconnectAttempts: number;
206
- private _handlers;
207
- private _ws;
208
- private _connected;
209
- private _intentionalClose;
210
- private _reconnectAttempts;
211
- private _eventCount;
313
+ protected _handlers: Map<string, Set<EventHandler$1<any>>>;
314
+ protected _ws: WebSocket | null;
315
+ protected _connected: boolean;
316
+ protected _intentionalClose: boolean;
317
+ protected _reconnectAttempts: number;
318
+ protected _eventCount: number;
319
+ protected _roomId: string;
320
+ protected _roomInfo: Record<string, any> | null;
212
321
  /**
213
322
  * Create a new TikTokLive client.
214
323
  *
@@ -228,15 +337,16 @@ declare class TikTokLive {
228
337
  /**
229
338
  * Register an event handler.
230
339
  *
340
+ * Supports both native TikTools event names and TTLC-compatible aliases:
341
+ * - `roomUser` → `roomUserSeq`
342
+ * - `questionNew` → `question`
343
+ * - `linkMicBattle` → `battle`
344
+ * - `linkMicArmies` → `battleArmies`
345
+ * - `emote` → `emoteChat`
346
+ *
231
347
  * @param event - Event name (chat, gift, like, follow, etc.)
232
348
  * @param handler - Callback function
233
349
  * @returns this (for chaining)
234
- *
235
- * @example
236
- * ```typescript
237
- * client.on('chat', (event) => console.log(event.comment));
238
- * client.on('gift', (event) => console.log(event.giftName));
239
- * ```
240
350
  */
241
351
  on<K extends keyof TikTokLiveEventMap>(event: K, handler: EventHandler$1<TikTokLiveEventMap[K]>): this;
242
352
  on(event: string, handler: EventHandler$1<any>): this;
@@ -247,7 +357,7 @@ declare class TikTokLive {
247
357
  * @param handler - The handler to remove
248
358
  */
249
359
  off(event: string, handler: EventHandler$1<any>): this;
250
- private _emit;
360
+ protected _emit(event: string, data: any): void;
251
361
  /**
252
362
  * Connect to the TikTok LIVE stream.
253
363
  *
@@ -263,6 +373,19 @@ declare class TikTokLive {
263
373
  * Disconnect from the stream.
264
374
  */
265
375
  disconnect(): void;
376
+ /**
377
+ * Get current connection state (TTLC-compatible).
378
+ */
379
+ getState(): {
380
+ isConnected: boolean;
381
+ roomId: string;
382
+ roomInfo: Record<string, any> | null;
383
+ uniqueId: string;
384
+ };
385
+ /**
386
+ * Get room info (TTLC-compatible).
387
+ */
388
+ getRoomInfo(): Record<string, any> | null;
266
389
  private _maybeReconnect;
267
390
  }
268
391
 
@@ -371,4 +494,140 @@ declare class TikTokCaptions {
371
494
  disconnect(): void;
372
495
  }
373
496
 
374
- export { type BattleEvent, type CaptionEvent, type ChatEvent, type ConnectedEvent, type CreditsEvent, type DisconnectedEvent, type ErrorEvent, type GiftEvent, type LikeEvent, type MemberEvent, type RoomUserSeqEvent, type SocialEvent, TikTokCaptions, type TikTokCaptionsEventMap, type TikTokCaptionsOptions, TikTokLive, type TikTokLiveEventMap, type TikTokLiveOptions, type TikTokUser, type TranslationEvent };
497
+ /**
498
+ * TikTok-Live-Connector (TTLC) compatibility layer.
499
+ *
500
+ * Drop-in replacement for `WebcastPushConnection` from `tiktok-live-connector`.
501
+ * Users can switch to TikTools by changing a single import line:
502
+ *
503
+ * ```diff
504
+ * - const { WebcastPushConnection } = require('tiktok-live-connector');
505
+ * + const { WebcastPushConnection } = require('tiktok-live-api');
506
+ * ```
507
+ *
508
+ * All TTLC event names, constructor options, and methods are supported.
509
+ *
510
+ * @packageDocumentation
511
+ */
512
+
513
+ /**
514
+ * Control events matching TikTok-Live-Connector's ControlEvents.
515
+ */
516
+ declare const ControlEvents: {
517
+ readonly CONNECTED: "connected";
518
+ readonly DISCONNECTED: "disconnected";
519
+ readonly ERROR: "error";
520
+ readonly RAWDATA: "rawData";
521
+ readonly DECODEDDATA: "decodedData";
522
+ readonly STREAMEND: "streamEnd";
523
+ readonly WSCONNECTED: "websocketConnected";
524
+ };
525
+ /**
526
+ * Message events matching TikTok-Live-Connector's MessageEvents.
527
+ */
528
+ declare const MessageEvents: {
529
+ readonly CHAT: "chat";
530
+ readonly MEMBER: "member";
531
+ readonly GIFT: "gift";
532
+ readonly ROOMUSER: "roomUser";
533
+ readonly SOCIAL: "social";
534
+ readonly LIKE: "like";
535
+ readonly QUESTIONNEW: "questionNew";
536
+ readonly LINKMICBATTLE: "linkMicBattle";
537
+ readonly LINKMICARMIES: "linkMicArmies";
538
+ readonly LIVEINTRO: "liveIntro";
539
+ readonly EMOTE: "emote";
540
+ readonly ENVELOPE: "envelope";
541
+ readonly SUBSCRIBE: "subscribe";
542
+ readonly BARRAGE: "barrage";
543
+ readonly SUPERFAN: "superFan";
544
+ readonly SUPERFANJOIN: "superFanJoin";
545
+ readonly SUPERFANBOX: "superFanBox";
546
+ readonly ROOMPIN: "roomPin";
547
+ };
548
+ /**
549
+ * Custom events matching TikTok-Live-Connector's CustomEvents.
550
+ */
551
+ declare const CustomEvents: {
552
+ readonly FOLLOW: "follow";
553
+ readonly SHARE: "share";
554
+ };
555
+ interface WebcastPushConnectionOptions extends TikTokLiveOptions {
556
+ /** Euler Stream API key (maps to TikTools apiKey). */
557
+ signApiKey?: string;
558
+ /** @deprecated Handled server-side. Accepted for compatibility. */
559
+ processInitialData?: boolean;
560
+ /** @deprecated Handled server-side. Accepted for compatibility. */
561
+ fetchRoomInfoOnConnect?: boolean;
562
+ /** @deprecated Always enabled. Accepted for compatibility. */
563
+ enableExtendedGiftInfo?: boolean;
564
+ /** @deprecated Always true. Accepted for compatibility. */
565
+ enableWebsocketUpgrade?: boolean;
566
+ /** @deprecated Not used. Accepted for compatibility. */
567
+ enableRequestPolling?: boolean;
568
+ /** @deprecated Not used. Accepted for compatibility. */
569
+ requestPollingIntervalMs?: number;
570
+ /** TikTok session ID. */
571
+ sessionId?: string;
572
+ /** @deprecated Not used. Accepted for compatibility. */
573
+ clientParams?: Record<string, any>;
574
+ /** @deprecated Not used. Accepted for compatibility. */
575
+ requestHeaders?: Record<string, string>;
576
+ /** @deprecated Not used. Accepted for compatibility. */
577
+ websocketHeaders?: Record<string, string>;
578
+ /** @deprecated Not used. Accepted for compatibility. */
579
+ requestOptions?: Record<string, any>;
580
+ /** @deprecated Not used. Accepted for compatibility. */
581
+ websocketOptions?: Record<string, any>;
582
+ /** @deprecated Not used. Accepted for compatibility. */
583
+ signProviderOptions?: Record<string, any>;
584
+ }
585
+ /**
586
+ * Drop-in replacement for TikTok-Live-Connector's `WebcastPushConnection`.
587
+ *
588
+ * Accepts the exact same constructor signature and event names.
589
+ * Under the hood, connects to the TikTools managed WebSocket API
590
+ * for 99.9% uptime and zero maintenance.
591
+ *
592
+ * @example
593
+ * ```typescript
594
+ * // Before (TikTok-Live-Connector):
595
+ * // const { WebcastPushConnection } = require('tiktok-live-connector');
596
+ *
597
+ * // After (TikTools — one-line change):
598
+ * const { WebcastPushConnection } = require('tiktok-live-api');
599
+ *
600
+ * const connection = new WebcastPushConnection('username', {
601
+ * signApiKey: 'YOUR_TIKTOOL_API_KEY', // Get free at tik.tools
602
+ * });
603
+ *
604
+ * connection.on('chat', (data) => {
605
+ * console.log(`${data.uniqueId}: ${data.comment}`);
606
+ * });
607
+ *
608
+ * connection.connect();
609
+ * ```
610
+ */
611
+ declare class WebcastPushConnection extends TikTokLive {
612
+ constructor(uniqueId: string, options?: WebcastPushConnectionOptions);
613
+ /**
614
+ * Get current connection state — TTLC-compatible shape.
615
+ *
616
+ * Returns the same structure as TikTok-Live-Connector's `getState()`.
617
+ */
618
+ getState(): {
619
+ isConnected: boolean;
620
+ upgradedToWebsocket: boolean;
621
+ roomId: string;
622
+ roomInfo: Record<string, any> | null;
623
+ availableGifts: never[];
624
+ uniqueId: string;
625
+ };
626
+ /**
627
+ * Get available gifts — TTLC-compatible.
628
+ * Note: Gift info is included in event payloads automatically.
629
+ */
630
+ getAvailableGifts(): any[];
631
+ }
632
+
633
+ export { type BarrageEvent, type BattleEvent, type CaptionEvent, type ChatEvent, type ConnectedEvent, type ControlEvent, ControlEvents, type CreditsEvent, CustomEvents, type DisconnectedEvent, type EmoteChatEvent, type ErrorEvent, type GiftEvent, type LikeEvent, type LinkMicEvent, type LiveIntroEvent, type MemberEvent, MessageEvents, type QuestionEvent, type RankUpdateEvent, type RoomPinEvent, type RoomUserSeqEvent, type SocialEvent, type SuperFanBoxEvent, type SuperFanEvent, type SuperFanJoinEvent, TikTokCaptions, type TikTokCaptionsEventMap, type TikTokCaptionsOptions, TikTokLive, type TikTokLiveEventMap, type TikTokLiveOptions, type TikTokUser, type TranslationEvent, WebcastPushConnection, type WebcastPushConnectionOptions };