@twurple/eventsub-ws
Advanced tools
Comparing version 7.0.0-pre.2 to 7.0.0-pre.3
@@ -122,3 +122,6 @@ "use strict"; | ||
} | ||
if (!this._sockets.has(authUserId)) { | ||
if (this._sockets.has(authUserId)) { | ||
this._sockets.get(authUserId).start(); | ||
} | ||
else { | ||
this._createSocketForUser(authUserId); | ||
@@ -125,0 +128,0 @@ } |
@@ -1,27 +0,2 @@ | ||
import { type LoggerOptions } from '@d-fischer/logger'; | ||
import { type EventSubWsListener } from './EventSubWsListener'; | ||
/** @private */ | ||
export declare class EventSubWsSocket { | ||
private readonly _listener; | ||
private readonly _userId; | ||
private readonly _connection; | ||
private _sessionId?; | ||
private readonly _initialUrl; | ||
private _reconnectInProgress; | ||
private _reconnectUrl?; | ||
private _keepaliveTimeout; | ||
private _keepaliveTimer; | ||
private readonly _logger; | ||
private _readyToSubscribe; | ||
constructor(_listener: EventSubWsListener, _userId: string, initialUrl: string, loggerOptions?: Partial<LoggerOptions>); | ||
start(): void; | ||
stop(): void; | ||
get readyToSubscribe(): boolean; | ||
get sessionId(): string | undefined; | ||
get userId(): string; | ||
private _initializeKeepaliveTimeout; | ||
private _clearKeepaliveTimer; | ||
private _restartKeepaliveTimer; | ||
private _handleKeepaliveTimeout; | ||
} | ||
export {}; | ||
//# sourceMappingURL=EventSubWsSocket.d.ts.map |
@@ -8,3 +8,3 @@ "use strict"; | ||
const shared_utils_1 = require("@d-fischer/shared-utils"); | ||
/** @private */ | ||
/** @internal */ | ||
class EventSubWsSocket { | ||
@@ -39,2 +39,5 @@ constructor(_listener, _userId, initialUrl, loggerOptions) { | ||
this._keepaliveTimeout = null; | ||
for (const sub of this._listener._getSubscriptionsForUser(this._userId)) { | ||
sub._droppedByTwitch(); | ||
} | ||
}); | ||
@@ -50,3 +53,9 @@ this._connection.onReceive(data => { | ||
if (!this._reconnectInProgress) { | ||
for (const sub of this._listener._getSubscriptionsForUser(this._userId)) { | ||
const subs = this._listener._getSubscriptionsForUser(this._userId); | ||
if (!subs.length) { | ||
this._logger.debug(`Stopping socket for user ${this._userId} because no subscriptions are active`); | ||
this.stop(); | ||
break; | ||
} | ||
for (const sub of subs) { | ||
sub.start(); | ||
@@ -110,6 +119,10 @@ } | ||
start() { | ||
this._connection.connect(); | ||
if (!this._connection.isConnected && !this._connection.isConnecting) { | ||
this._connection.connect(); | ||
} | ||
} | ||
stop() { | ||
this._connection.disconnect(); | ||
if (this._connection.isConnected || this._connection.isConnecting) { | ||
this._connection.disconnect(); | ||
} | ||
} | ||
@@ -116,0 +129,0 @@ get readyToSubscribe() { |
{ | ||
"name": "@twurple/eventsub-ws", | ||
"version": "7.0.0-pre.2", | ||
"version": "7.0.0-pre.3", | ||
"publishConfig": { | ||
@@ -40,12 +40,12 @@ "access": "public" | ||
"@d-fischer/typed-event-emitter": "^3.3.0", | ||
"@twurple/auth": "7.0.0-pre.2", | ||
"@twurple/common": "7.0.0-pre.2", | ||
"@twurple/eventsub-base": "7.0.0-pre.2", | ||
"@twurple/auth": "7.0.0-pre.3", | ||
"@twurple/common": "7.0.0-pre.3", | ||
"@twurple/eventsub-base": "7.0.0-pre.3", | ||
"tslib": "^2.0.3" | ||
}, | ||
"devDependencies": { | ||
"@twurple/api": "7.0.0-pre.2" | ||
"@twurple/api": "7.0.0-pre.3" | ||
}, | ||
"peerDependencies": { | ||
"@twurple/api": "7.0.0-pre.2" | ||
"@twurple/api": "7.0.0-pre.3" | ||
}, | ||
@@ -52,0 +52,0 @@ "files": [ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
31656
721
+ Added@twurple/api@7.0.0-pre.3(transitive)
+ Added@twurple/api-call@7.0.0-pre.3(transitive)
+ Added@twurple/auth@7.0.0-pre.3(transitive)
+ Added@twurple/common@7.0.0-pre.3(transitive)
+ Added@twurple/eventsub-base@7.0.0-pre.3(transitive)
+ Added@types/node@22.9.3(transitive)
+ Addedis-async-function@2.0.0(transitive)
+ Addedis-finalizationregistry@1.1.0(transitive)
+ Addedis-generator-function@1.0.10(transitive)
+ Addedis-weakmap@2.0.2(transitive)
+ Addedis-weakset@2.0.3(transitive)
+ Addedreflect.getprototypeof@1.0.7(transitive)
+ Addedtyped-array-byte-offset@1.0.3(transitive)
+ Addedtyped-array-length@1.0.7(transitive)
+ Addedwhich-builtin-type@1.2.0(transitive)
+ Addedwhich-collection@1.0.2(transitive)
- Removed@twurple/api@7.0.0-pre.2(transitive)
- Removed@twurple/api-call@7.0.0-pre.2(transitive)
- Removed@twurple/auth@7.0.0-pre.2(transitive)
- Removed@twurple/common@7.0.0-pre.2(transitive)
- Removed@twurple/eventsub-base@7.0.0-pre.2(transitive)
- Removed@types/node@22.9.1(transitive)
- Removedtyped-array-byte-offset@1.0.2(transitive)
- Removedtyped-array-length@1.0.6(transitive)
Updated@twurple/auth@7.0.0-pre.3
Updated@twurple/common@7.0.0-pre.3