Unlink on device conflict 4409
This commit is contained in:
parent
e12b5fd0af
commit
a27890b988
2 changed files with 11 additions and 0 deletions
|
@ -248,6 +248,11 @@ export class SocketManager extends EventListener {
|
|||
return;
|
||||
}
|
||||
|
||||
if (code === 4409) {
|
||||
this.emit('deviceConflict');
|
||||
return;
|
||||
}
|
||||
|
||||
void reconnect();
|
||||
});
|
||||
}
|
||||
|
@ -700,6 +705,7 @@ export class SocketManager extends EventListener {
|
|||
callback: (error: HTTPError) => void
|
||||
): this;
|
||||
public override on(type: 'statusChange', callback: () => void): this;
|
||||
public override on(type: 'deviceConflict', callback: () => void): this;
|
||||
|
||||
public override on(
|
||||
type: string | symbol,
|
||||
|
@ -711,6 +717,7 @@ export class SocketManager extends EventListener {
|
|||
|
||||
public override emit(type: 'authError', error: HTTPError): boolean;
|
||||
public override emit(type: 'statusChange'): boolean;
|
||||
public override emit(type: 'deviceConflict'): boolean;
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
public override emit(type: string | symbol, ...args: Array<any>): boolean {
|
||||
|
|
|
@ -1320,6 +1320,10 @@ export function initialize({
|
|||
window.Whisper.events.trigger('unlinkAndDisconnect');
|
||||
});
|
||||
|
||||
socketManager.on('deviceConflict', () => {
|
||||
window.Whisper.events.trigger('unlinkAndDisconnect');
|
||||
});
|
||||
|
||||
if (useWebSocket) {
|
||||
void socketManager.authenticate({ username, password });
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue