@tiktool/live 2.11.1 → 2.11.2
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 +16 -19
- package/dist/index.d.mts +14 -14
- package/dist/index.d.ts +14 -14
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -77,40 +77,39 @@ There are **two ways** to receive TikTok LIVE events from `tik.tools`. Pick base
|
|
|
77
77
|
Your App ◀────────────────── live events ────────────────────── TikTok
|
|
78
78
|
```
|
|
79
79
|
|
|
80
|
-
-
|
|
81
|
-
-
|
|
82
|
-
-
|
|
83
|
-
-
|
|
80
|
+
- The signed WebSocket is opened from your runtime. TikTok sees the network identity of the host that runs the SDK.
|
|
81
|
+
- Lowest per-stream cost — only the initial `ws_credentials` call is billed against your API key.
|
|
82
|
+
- Suited to **low- to mid-volume** workloads from a single host.
|
|
83
|
+
- High-volume setups should prefer Mode 2 for predictable, centrally-managed egress.
|
|
84
84
|
|
|
85
85
|
```typescript
|
|
86
86
|
const live = new TikTokLive({
|
|
87
87
|
uniqueId: 'creator_username',
|
|
88
88
|
apiKey: 'YOUR_TIKTOOLS_KEY',
|
|
89
|
-
// Optional: route WS + HTTP through
|
|
90
|
-
proxy: 'http://USER:PASS@
|
|
89
|
+
// Optional: route outbound WS + HTTP through a corporate / egress gateway
|
|
90
|
+
// proxy: 'http://USER:PASS@gateway.your-company.com:port',
|
|
91
91
|
});
|
|
92
92
|
```
|
|
93
93
|
|
|
94
|
-
|
|
94
|
+
If you set the optional `proxy` field, install the standard agent:
|
|
95
95
|
|
|
96
96
|
```bash
|
|
97
97
|
npm install https-proxy-agent
|
|
98
98
|
```
|
|
99
99
|
|
|
100
|
-
### Mode 2 — Relayed (via
|
|
100
|
+
### Mode 2 — Relayed (via TikTools managed edge)
|
|
101
101
|
|
|
102
102
|
```
|
|
103
103
|
Your App ◀──── wss://api.tik.tools/?... ──── tik.tools
|
|
104
104
|
│
|
|
105
|
-
│
|
|
106
|
-
│ rotated proxies
|
|
105
|
+
│ managed edge
|
|
107
106
|
▼
|
|
108
107
|
TikTok
|
|
109
108
|
```
|
|
110
109
|
|
|
111
|
-
-
|
|
112
|
-
-
|
|
113
|
-
-
|
|
110
|
+
- The TikTools service handles the upstream TikTok session and forwards decoded events over a single WebSocket to your client.
|
|
111
|
+
- Single, stable egress — your application connects only to `api.tik.tools`.
|
|
112
|
+
- Recommended for **production scale**, multi-tenant deployments, or any environment that already centralizes outbound traffic.
|
|
114
113
|
|
|
115
114
|
**Easiest — same SDK, one option:**
|
|
116
115
|
|
|
@@ -155,12 +154,10 @@ Use this when integrating from a non-Node runtime (Python, Go, Bun, browser) or
|
|
|
155
154
|
|
|
156
155
|
| Aspect | Direct (Mode 1) | Relayed (Mode 2) |
|
|
157
156
|
|---|---|---|
|
|
158
|
-
|
|
|
159
|
-
| Setup | `new TikTokLive(...)` | `new
|
|
160
|
-
|
|
|
161
|
-
|
|
|
162
|
-
| TikTok rate-limit risk | Yes (mitigated with `proxy`) | None — we handle it |
|
|
163
|
-
| Best for | Hobby / single-creator | Production at scale |
|
|
157
|
+
| WebSocket opens from | Your runtime | TikTools managed edge |
|
|
158
|
+
| Setup | `new TikTokLive(...)` | `new TikTokLive({ ..., mode: 'relayed' })` |
|
|
159
|
+
| Egress | Your host's network | Single endpoint: `api.tik.tools` |
|
|
160
|
+
| Best for | Low- to mid-volume | Production scale, multi-tenant |
|
|
164
161
|
|
|
165
162
|
---
|
|
166
163
|
|
package/dist/index.d.mts
CHANGED
|
@@ -280,26 +280,26 @@ interface TikTokLiveOptions {
|
|
|
280
280
|
/** Pre-resolved ttwid session cookie — skips direct TikTok page fetch when provided with roomId */
|
|
281
281
|
sessionId?: string;
|
|
282
282
|
/**
|
|
283
|
-
* Optional HTTP
|
|
284
|
-
*
|
|
285
|
-
*
|
|
286
|
-
*
|
|
283
|
+
* Optional outbound HTTP(S) gateway URL. When set, the SDK's outbound
|
|
284
|
+
* WebSocket and HTTP requests are routed through this gateway instead
|
|
285
|
+
* of the host's default network interface. Useful for environments that
|
|
286
|
+
* need a stable egress IP or that already centralize outbound traffic
|
|
287
|
+
* through a corporate gateway.
|
|
287
288
|
*
|
|
288
289
|
* Format: `http://user:pass@host:port` or `http://host:port`.
|
|
289
|
-
*
|
|
290
|
-
* Example (Webshare residential):
|
|
291
|
-
* proxy: 'http://USER:PASS@p.webshare.io:80'
|
|
292
290
|
*/
|
|
293
291
|
proxy?: string;
|
|
294
292
|
/**
|
|
295
293
|
* Connection mode.
|
|
296
|
-
* - `'direct'` (default): SDK opens WebSocket
|
|
297
|
-
*
|
|
298
|
-
*
|
|
299
|
-
*
|
|
300
|
-
*
|
|
301
|
-
*
|
|
302
|
-
*
|
|
294
|
+
* - `'direct'` (default): SDK opens the WebSocket from your runtime to
|
|
295
|
+
* TikTok using credentials signed by the TikTools sign server.
|
|
296
|
+
* Best for low-volume use where you'd rather not stream events
|
|
297
|
+
* through our infrastructure.
|
|
298
|
+
* - `'relayed'`: SDK connects to the TikTools managed edge
|
|
299
|
+
* (`wss://api.tik.tools/...`). The TikTools service handles the
|
|
300
|
+
* upstream TikTok session and forwards decoded events to your
|
|
301
|
+
* client. Best for production scale and for environments where
|
|
302
|
+
* you want a single, stable egress through TikTools.
|
|
303
303
|
*
|
|
304
304
|
* The decoded events emitted are identical in both modes — code that
|
|
305
305
|
* uses `client.on('chat', e => ...)` works without changes.
|
package/dist/index.d.ts
CHANGED
|
@@ -280,26 +280,26 @@ interface TikTokLiveOptions {
|
|
|
280
280
|
/** Pre-resolved ttwid session cookie — skips direct TikTok page fetch when provided with roomId */
|
|
281
281
|
sessionId?: string;
|
|
282
282
|
/**
|
|
283
|
-
* Optional HTTP
|
|
284
|
-
*
|
|
285
|
-
*
|
|
286
|
-
*
|
|
283
|
+
* Optional outbound HTTP(S) gateway URL. When set, the SDK's outbound
|
|
284
|
+
* WebSocket and HTTP requests are routed through this gateway instead
|
|
285
|
+
* of the host's default network interface. Useful for environments that
|
|
286
|
+
* need a stable egress IP or that already centralize outbound traffic
|
|
287
|
+
* through a corporate gateway.
|
|
287
288
|
*
|
|
288
289
|
* Format: `http://user:pass@host:port` or `http://host:port`.
|
|
289
|
-
*
|
|
290
|
-
* Example (Webshare residential):
|
|
291
|
-
* proxy: 'http://USER:PASS@p.webshare.io:80'
|
|
292
290
|
*/
|
|
293
291
|
proxy?: string;
|
|
294
292
|
/**
|
|
295
293
|
* Connection mode.
|
|
296
|
-
* - `'direct'` (default): SDK opens WebSocket
|
|
297
|
-
*
|
|
298
|
-
*
|
|
299
|
-
*
|
|
300
|
-
*
|
|
301
|
-
*
|
|
302
|
-
*
|
|
294
|
+
* - `'direct'` (default): SDK opens the WebSocket from your runtime to
|
|
295
|
+
* TikTok using credentials signed by the TikTools sign server.
|
|
296
|
+
* Best for low-volume use where you'd rather not stream events
|
|
297
|
+
* through our infrastructure.
|
|
298
|
+
* - `'relayed'`: SDK connects to the TikTools managed edge
|
|
299
|
+
* (`wss://api.tik.tools/...`). The TikTools service handles the
|
|
300
|
+
* upstream TikTok session and forwards decoded events to your
|
|
301
|
+
* client. Best for production scale and for environments where
|
|
302
|
+
* you want a single, stable egress through TikTools.
|
|
303
303
|
*
|
|
304
304
|
* The decoded events emitted are identical in both modes — code that
|
|
305
305
|
* uses `client.on('chat', e => ...)` works without changes.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tiktool/live",
|
|
3
|
-
"version": "2.11.
|
|
3
|
+
"version": "2.11.2",
|
|
4
4
|
"description": "TikTok LIVE API Client — Real-time chat, gifts, viewers, PK battles with MVP breakdown, x2/x3 boosters, gloves, mist, match-guide & 20+ event types from any TikTok livestream. Direct WebSocket connection.",
|
|
5
5
|
"author": "tiktool",
|
|
6
6
|
"license": "MIT",
|