Skip to content

Commit

Permalink
Fix websocket upgrade
Browse files Browse the repository at this point in the history
  • Loading branch information
zerodytrash committed Jul 4, 2024
1 parent 77df58a commit f31c7de
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "tiktok-live-connector",
"version": "1.1.7",
"version": "1.1.8",
"description": "Node.js module to receive live stream chat events like comments and gifts from TikTok LIVE",
"main": "index.js",
"types": "./dist/index.d.ts",
Expand Down
6 changes: 4 additions & 2 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -440,11 +440,13 @@ class WebcastPushConnection extends EventEmitter {
try {
// Websocket specific params
let wsParams = {
imprp: webcastResponse.wsParam?.value || '',
wrss: webcastResponse.wsParam?.value || '',
compress: 'gzip',
};

for (let wsParam of webcastResponse.wsParams) {
wsParams[wsParam.name] = wsParam.value;
}

// Wait until ws connected, then stop request polling
await this.#setupWebsocket(webcastResponse.wsUrl, wsParams);

Expand Down
2 changes: 1 addition & 1 deletion src/proto/tiktokSchema.proto
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ message WebcastResponse {
int64 serverTimestamp = 4;
string internalExt = 5;
int32 fetchType = 6; // ws (1) or polling (2)
WebsocketParam wsParam = 7;
repeated WebsocketParam wsParams = 7;
int32 heartbeatDuration = 8;
bool needAck = 9;
string wsUrl = 10;
Expand Down

0 comments on commit f31c7de

Please sign in to comment.