MCPcopy
hub / github.com/Effect-TS/effect / onConnection

Function onConnection

packages/platform-node-shared/src/NodeSocketServer.ts:192–209  ·  view source on GitHub ↗
(conn: Net.Socket, req: Http.IncomingMessage)

Source from the content-addressed store, hash-verified

190 )
191 const run = yield* FiberSet.runtime(fiberSet)<R>()
192 function onConnection(conn: Net.Socket, req: Http.IncomingMessage) {
193 pipe(
194 Socket.fromWebSocket(
195 Effect.acquireRelease(
196 Effect.succeed(conn as unknown as globalThis.WebSocket),
197 (conn) =>
198 Effect.sync(() => {
199 conn.close()
200 })
201 )
202 ),
203 Effect.flatMap(handler),
204 Effect.catchAllCause(reportUnhandledError),
205 Effect.provideService(Socket.WebSocket, conn as any),
206 Effect.provideService(IncomingMessage, req),
207 run
208 )
209 }
210 return yield* Effect.async<never>((_resume) => {
211 server.on("connection", onConnection)
212 return Effect.sync(() => {

Callers 1

Calls 3

syncMethod · 0.80
closeMethod · 0.65
pipeFunction · 0.50

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…