mirror of
https://github.com/th-ch/youtube-music.git
synced 2026-01-11 10:31:47 +00:00
fix(music-together): fix connection disconnect message
This commit is contained in:
@ -135,6 +135,11 @@ export class Connection {
|
|||||||
if (this._mode === 'disconnected') throw new Error('Already disconnected');
|
if (this._mode === 'disconnected') throw new Error('Already disconnected');
|
||||||
|
|
||||||
this._mode = 'disconnected';
|
this._mode = 'disconnected';
|
||||||
|
this.getConnections().forEach((conn) =>
|
||||||
|
conn.close({
|
||||||
|
flush: true,
|
||||||
|
}),
|
||||||
|
);
|
||||||
this.connections = {};
|
this.connections = {};
|
||||||
this.connectionListeners = [];
|
this.connectionListeners = [];
|
||||||
for (const listener of this.listeners) {
|
for (const listener of this.listeners) {
|
||||||
@ -228,6 +233,9 @@ export class Connection {
|
|||||||
this.connectionListeners.forEach((listener) => listener(conn));
|
this.connectionListeners.forEach((listener) => listener(conn));
|
||||||
|
|
||||||
if (err) {
|
if (err) {
|
||||||
|
if (err.type === 'connection-closed') {
|
||||||
|
this.connectionListeners.forEach((listener) => listener());
|
||||||
|
}
|
||||||
reject(err);
|
reject(err);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user