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

Method handleOk

desktop/src/shared/api/relayClientSession.ts:845–875  ·  view source on GitHub ↗
(eventId: string, success: boolean, message: string)

Source from the content-addressed store, hash-verified

843 }
844
845 private handleOk(eventId: string, success: boolean, message: string) {
846 if (this.authRequest && this.authRequest.pendingEventId === eventId) {
847 window.clearTimeout(this.authRequest.timeout);
848 const authRequest = this.authRequest;
849 this.authRequest = null;
850
851 if (success) {
852 authRequest.resolve();
853 } else {
854 const error = new Error(message || "Relay authentication rejected.");
855 authRequest.reject(error);
856 this.resetConnection(error, { reconnect: false });
857 }
858
859 return;
860 }
861
862 const pendingEvent = this.pendingEvents.get(eventId);
863 if (!pendingEvent) {
864 return;
865 }
866
867 window.clearTimeout(pendingEvent.timeout);
868 this.pendingEvents.delete(eventId);
869
870 if (success) {
871 pendingEvent.resolve(pendingEvent.event);
872 } else {
873 pendingEvent.reject(new Error(message || "Relay rejected the event."));
874 }
875 }
876
877 private hasLiveSubscriptions() {
878 for (const subscription of this.subscriptions.values()) {

Callers 1

handleWsMessageMethod · 0.95

Calls 3

resetConnectionMethod · 0.95
getMethod · 0.45
deleteMethod · 0.45

Tested by

no test coverage detected