fix(core): update
This commit is contained in:
parent
5139136af4
commit
105acaf97b
@ -1,3 +1,5 @@
|
|||||||
export interface IRequestAuthPayload {
|
export interface IRequestAuthPayload {
|
||||||
serverShortId: string;
|
serverShortId: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export type TConnectionEvent = 'terminated' | 'error';
|
@ -55,7 +55,7 @@ export class SocketConnection {
|
|||||||
public smartsocketRef: Smartsocket | SmartsocketClient;
|
public smartsocketRef: Smartsocket | SmartsocketClient;
|
||||||
public socket: SocketIO.Socket | SocketIOClient.Socket;
|
public socket: SocketIO.Socket | SocketIOClient.Socket;
|
||||||
|
|
||||||
public eventSubject = new plugins.smartrx.rxjs.Subject();
|
public eventSubject = new plugins.smartrx.rxjs.Subject<interfaces.TConnectionEvent>();
|
||||||
|
|
||||||
constructor(optionsArg: ISocketConnectionConstructorOptions) {
|
constructor(optionsArg: ISocketConnectionConstructorOptions) {
|
||||||
this.alias = optionsArg.alias;
|
this.alias = optionsArg.alias;
|
||||||
@ -67,12 +67,12 @@ export class SocketConnection {
|
|||||||
|
|
||||||
// standard behaviour that is always true
|
// standard behaviour that is always true
|
||||||
allSocketConnections.add(this);
|
allSocketConnections.add(this);
|
||||||
this.socket.on('disconnect', () => {
|
this.socket.on('disconnect', async () => {
|
||||||
plugins.smartlog.defaultLogger.log(
|
plugins.smartlog.defaultLogger.log(
|
||||||
'info',
|
'info',
|
||||||
`SocketConnection with >alias ${this.alias} on >side ${this.side} disconnected`
|
`SocketConnection with >alias ${this.alias} on >side ${this.side} disconnected`
|
||||||
);
|
);
|
||||||
this.socket.disconnect();
|
await this.disconnect();
|
||||||
allSocketConnections.remove(this);
|
allSocketConnections.remove(this);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -173,5 +173,6 @@ export class SocketConnection {
|
|||||||
// disconnecting ----------------------
|
// disconnecting ----------------------
|
||||||
public async disconnect() {
|
public async disconnect() {
|
||||||
this.socket.disconnect(true);
|
this.socket.disconnect(true);
|
||||||
|
this.eventSubject.next('terminated');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user