feat: emit closed
This commit is contained in:
@ -51,6 +51,7 @@ interface ConnectionEvents {
|
|||||||
connected: (wasReconnect: boolean) => void;
|
connected: (wasReconnect: boolean) => void;
|
||||||
event: (sub: string, e: TaggedNostrEvent) => void;
|
event: (sub: string, e: TaggedNostrEvent) => void;
|
||||||
eose: (sub: string) => void;
|
eose: (sub: string) => void;
|
||||||
|
closed: (sub: string, reason: string) => void;
|
||||||
disconnect: (code: number) => void;
|
disconnect: (code: number) => void;
|
||||||
auth: (challenge: string, relay: string, cb: (ev: NostrEvent) => void) => void;
|
auth: (challenge: string, relay: string, cb: (ev: NostrEvent) => void) => void;
|
||||||
notice: (msg: string) => void;
|
notice: (msg: string) => void;
|
||||||
@ -252,6 +253,10 @@ export class Connection extends EventEmitter<ConnectionEvents> {
|
|||||||
this.#log(`NOTICE: ${msg[1]}`);
|
this.#log(`NOTICE: ${msg[1]}`);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case "CLOSED": {
|
||||||
|
this.emit("closed", msg[1] as string, msg[2] as string);
|
||||||
|
this.#log(`CLOSED: ${msg.slice(1)}`);
|
||||||
|
}
|
||||||
default: {
|
default: {
|
||||||
this.#log(`Unknown tag: ${tag}`);
|
this.#log(`Unknown tag: ${tag}`);
|
||||||
break;
|
break;
|
||||||
|
Reference in New Issue
Block a user