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

Method requestHistory

desktop/src/shared/api/relayClientSession.ts:233–260  ·  view source on GitHub ↗
(filter: RelaySubscriptionFilter)

Source from the content-addressed store, hash-verified

231 }
232
233 private requestHistory(filter: RelaySubscriptionFilter) {
234 return new Promise<RelayEvent[]>((resolve, reject) => {
235 const subId = `history-${crypto.randomUUID()}`;
236 const timeout = window.setTimeout(() => {
237 this.subscriptions.delete(subId);
238 void this.closeSubscription(subId);
239 reject(new Error("Timed out while loading channel history."));
240 }, 8_000);
241
242 this.subscriptions.set(subId, {
243 mode: "history",
244 events: [],
245 resolve,
246 reject,
247 timeout,
248 });
249
250 void this.sendRaw(["REQ", subId, filter]).catch((error) => {
251 window.clearTimeout(timeout);
252 this.subscriptions.delete(subId);
253 reject(
254 error instanceof Error
255 ? error
256 : new Error("Failed to request channel history."),
257 );
258 });
259 });
260 }
261
262 async sendMessage(
263 channelId: string,

Callers 3

fetchChunkedAuxEventsMethod · 0.95
fetchHistoryMethod · 0.95

Calls 5

closeSubscriptionMethod · 0.95
sendRawMethod · 0.95
setMethod · 0.80
rejectFunction · 0.50
deleteMethod · 0.45

Tested by

no test coverage detected