🆕 Disconnection handler, when you got disconnected you automatic go back to the room

This commit is contained in:
duckietm
2026-03-19 15:04:47 +01:00
parent eee289e8f2
commit 5aef7a3de2
16 changed files with 498 additions and 87 deletions
+4
View File
@@ -8,6 +8,10 @@ export class NitroEventType
public static readonly SOCKET_CLOSED = 'SOCKET_CLOSED';
public static readonly SOCKET_ERROR = 'SOCKET_ERROR';
public static readonly SOCKET_CONNECTED = 'SOCKET_CONNECTED';
public static readonly SOCKET_RECONNECTING = 'SOCKET_RECONNECTING';
public static readonly SOCKET_RECONNECTED = 'SOCKET_RECONNECTED';
public static readonly SOCKET_RECONNECT_FAILED = 'SOCKET_RECONNECT_FAILED';
public static readonly SOCKET_REAUTHENTICATED = 'SOCKET_REAUTHENTICATED';
public static readonly AVATAR_ASSET_DOWNLOADED = 'AVATAR_ASSET_DOWNLOADED';
public static readonly AVATAR_ASSET_LOADED = 'AVATAR_ASSET_LOADED';
public static readonly AVATAR_EFFECT_DOWNLOADED = 'AVATAR_EFFECT_DOWNLOADED';
@@ -0,0 +1,25 @@
import { NitroEvent } from './NitroEvent';
export class ReconnectEvent extends NitroEvent
{
private _attempt: number;
private _maxAttempts: number;
constructor(type: string, attempt: number = 0, maxAttempts: number = 0)
{
super(type);
this._attempt = attempt;
this._maxAttempts = maxAttempts;
}
public get attempt(): number
{
return this._attempt;
}
public get maxAttempts(): number
{
return this._maxAttempts;
}
}
+1
View File
@@ -1,4 +1,5 @@
export * from './ConfigurationEvent';
export * from './MessageEvent';
export * from './NitroEvent';
export * from './ReconnectEvent';
export * from './SocketConnectionEvent';