Skip to content

Commit f31c7de

Browse files
committed
Fix websocket upgrade
1 parent 77df58a commit f31c7de

File tree

3 files changed

+6
-4
lines changed

3 files changed

+6
-4
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "tiktok-live-connector",
3-
"version": "1.1.7",
3+
"version": "1.1.8",
44
"description": "Node.js module to receive live stream chat events like comments and gifts from TikTok LIVE",
55
"main": "index.js",
66
"types": "./dist/index.d.ts",

src/index.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -440,11 +440,13 @@ class WebcastPushConnection extends EventEmitter {
440440
try {
441441
// Websocket specific params
442442
let wsParams = {
443-
imprp: webcastResponse.wsParam?.value || '',
444-
wrss: webcastResponse.wsParam?.value || '',
445443
compress: 'gzip',
446444
};
447445

446+
for (let wsParam of webcastResponse.wsParams) {
447+
wsParams[wsParam.name] = wsParam.value;
448+
}
449+
448450
// Wait until ws connected, then stop request polling
449451
await this.#setupWebsocket(webcastResponse.wsUrl, wsParams);
450452

src/proto/tiktokSchema.proto

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ message WebcastResponse {
99
int64 serverTimestamp = 4;
1010
string internalExt = 5;
1111
int32 fetchType = 6; // ws (1) or polling (2)
12-
WebsocketParam wsParam = 7;
12+
repeated WebsocketParam wsParams = 7;
1313
int32 heartbeatDuration = 8;
1414
bool needAck = 9;
1515
string wsUrl = 10;

0 commit comments

Comments
 (0)