MCPcopy Create free account
hub / github.com/block/buzz / disconnect

Method disconnect

desktop/src/shared/api/readOnlyRelayClient.ts:61–84  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

59 }
60
61 disconnect(): void {
62 const error = new Error("Read-only relay observer disconnected.");
63 this.generation++;
64
65 if (this.wsId !== null) {
66 void closeWebSocket(this.wsId, "observer disconnected");
67 this.wsId = null;
68 }
69
70 if (this.authRequest) {
71 window.clearTimeout(this.authRequest.timeout);
72 this.authRequest.reject(error);
73 this.authRequest = null;
74 }
75
76 for (const [subId, pending] of this.histories) {
77 window.clearTimeout(pending.timeout);
78 pending.reject(error);
79 this.histories.delete(subId);
80 }
81
82 this.onMessageChannel = null;
83 this.connectPromise = null;
84 }
85
86 async fetchEvents(filter: RelaySubscriptionFilter): Promise<RelayEvent[]> {
87 await this.connect();

Callers 4

openConnectionMethod · 0.95
handleWsMessageMethod · 0.95
handleOkMethod · 0.95
withReadOnlyRelayClientFunction · 0.95

Calls 2

closeWebSocketFunction · 0.90
deleteMethod · 0.45

Tested by

no test coverage detected