@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 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
- - **TikTok sees your IP.** Cheapest on our API quota (only the `ws_credentials` call is charged per connection).
81
- - Good for **up to ~30 concurrent streams** from one container.
82
- - Above that, TikTok's per-IP rate limit kicks in → frequent `code=1006` closes + reconnect loops.
83
- - **Solution at scale**: enable the `proxy` option (below) to dial through your own residential pool.
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 your own proxy (recommended for 30+ streams)
90
- proxy: 'http://USER:PASS@p.webshare.io:80',
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
- Install `https-proxy-agent` if using `proxy`:
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 our proxy pool)
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
- │ WS via
106
- │ rotated proxies
105
+ │ managed edge
107
106
  ▼
108
107
  TikTok
109
108
  ```
110
109
 
111
- - **TikTok sees our IPs** (rotated across hundreds of Webshare + residential proxies).
112
- - We absorb every per-IP rate-limit hit. Survives any block automatically.
113
- - Best for **30+ concurrent streams**, low-budget setups, or anyone who doesn't want their own IP fingerprinted by TikTok.
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
- | TikTok sees | Your IP | Our rotated proxy pool |
159
- | Setup | `new TikTokLive(...)` | `new WebSocket(url)` |
160
- | Scale limit | ~30 streams / container IP | Thousands |
161
- | Per-event cost | 1× `ws_credentials` per (re)connect | 1× per event |
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/HTTPS proxy URL. When set, the SDK's outbound WebSocket
284
- * (and HTTP requests) tunnel through this proxy instead of your container's
285
- * IP. Required when running 50+ concurrent direct connections to avoid
286
- * TikTok's per-IP rate limiting (manifests as code=1006 abnormal closes).
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 directly to TikTok. TikTok
297
- * sees your IP. Cheapest on API quota. Limited to ~30 concurrent
298
- * streams per container before TikTok rate-limits.
299
- * - `'relayed'`: SDK connects to TikTools' managed relay
300
- * (`wss://api.tik.tools/?...`). We connect to TikTok on your behalf
301
- * from our rotated proxy pool. TikTok never sees your IP. No rate-
302
- * limit risk. Scales to thousands of concurrent streams.
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/HTTPS proxy URL. When set, the SDK's outbound WebSocket
284
- * (and HTTP requests) tunnel through this proxy instead of your container's
285
- * IP. Required when running 50+ concurrent direct connections to avoid
286
- * TikTok's per-IP rate limiting (manifests as code=1006 abnormal closes).
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 directly to TikTok. TikTok
297
- * sees your IP. Cheapest on API quota. Limited to ~30 concurrent
298
- * streams per container before TikTok rate-limits.
299
- * - `'relayed'`: SDK connects to TikTools' managed relay
300
- * (`wss://api.tik.tools/?...`). We connect to TikTok on your behalf
301
- * from our rotated proxy pool. TikTok never sees your IP. No rate-
302
- * limit risk. Scales to thousands of concurrent streams.
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.1",
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",