Skip to content

Commit

Permalink
Fix Already connected! error
Browse files Browse the repository at this point in the history
  • Loading branch information
zerodytrash committed Sep 15, 2022
1 parent e838967 commit bcaca69
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 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.0.0",
"version": "1.0.1",
"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
4 changes: 2 additions & 2 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -159,8 +159,6 @@ class WebcastPushConnection extends EventEmitter {

await this.#fetchRoomData(true);

this.#isConnected = true;

// Sometimes no upgrade to WebSocket is offered by TikTok
// In that case we use request polling (if enabled and possible)
if (!this.#isWsUpgradeDone) {
Expand All @@ -179,6 +177,8 @@ class WebcastPushConnection extends EventEmitter {
this.#startFetchRoomPolling();
}

this.#isConnected = true;

let state = this.getState();

this.emit(ControlEvents.CONNECTED, state);
Expand Down

0 comments on commit bcaca69

Please sign in to comment.