diff --git a/package.json b/package.json index fe3a6e4..6e2ba0a 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/src/index.js b/src/index.js index 565adc6..8a9e6cd 100644 --- a/src/index.js +++ b/src/index.js @@ -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) { @@ -179,6 +177,8 @@ class WebcastPushConnection extends EventEmitter { this.#startFetchRoomPolling(); } + this.#isConnected = true; + let state = this.getState(); this.emit(ControlEvents.CONNECTED, state);