MCPcopy
hub / github.com/partykit/partykit / onRequest

Method onRequest

examples/socket.io-chat/src/server.ts:89–96  ·  view source on GitHub ↗
(req: Party.Request)

Source from the content-addressed store, hash-verified

87 onFetch = Server.onFetch;
88
89 async onRequest(req: Party.Request): Promise<Response> {
90 const url = new URL(req.url);
91 if (url.pathname.endsWith(`/user-count`) && req.method === "GET") {
92 console.log("user-count", [...this.room.getConnections()].length);
93 return new Response([...this.room.getConnections()].length.toString());
94 }
95 return super.onRequest(req);
96 }
97}

Callers

nothing calls this directly

Calls 2

getConnectionsMethod · 0.65
toStringMethod · 0.45

Tested by

no test coverage detected