MCPcopy
hub / github.com/anomalyco/opencode / fetch

Method fetch

packages/function/src/api.ts:20–37  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

18 super(ctx, env)
19 }
20 async fetch() {
21 console.log("SyncServer subscribe")
22
23 const webSocketPair = new WebSocketPair()
24 const [client, server] = Object.values(webSocketPair)
25
26 this.ctx.acceptWebSocket(server)
27
28 const data = await this.ctx.storage.list()
29 Array.from(data.entries())
30 .filter(([key, _]) => key.startsWith("session/"))
31 .map(([key, content]) => server.send(JSON.stringify({ key, content })))
32
33 return new Response(null, {
34 status: 101,
35 webSocket: client,
36 })
37 }
38
39 async webSocketMessage(_ws, _message) {}
40

Callers 15

api.tsFile · 0.80
registerRendererProtocolFunction · 0.80
fetchFunction · 0.80
aws.tsFile · 0.80
clientFunction · 0.80
clientFunction · 0.80
requestFunction · 0.80
serverFetchFunction · 0.80
index.tsFile · 0.80
fetchFunction · 0.80

Calls 5

listMethod · 0.65
logMethod · 0.45
valuesMethod · 0.45
fromMethod · 0.45
sendMethod · 0.45

Tested by 4

clientFunction · 0.64
clientFunction · 0.64
requestFunction · 0.64
serverFetchFunction · 0.64