MCPcopy Create free account
hub / github.com/Effect-TS/effect / connect

Function connect

packages/platform/node/test/NodeHttpServer.test.ts:812–820  ·  view source on GitHub ↗
(perMessageDeflate: boolean)

Source from the content-addressed store, hash-verified

810 const port = (server.address as HttpServer.TcpAddress).port
811
812 const connect = (perMessageDeflate: boolean) =>
813 Effect.acquireRelease(
814 Effect.callback<NodeWS.WebSocket, Error>((resume) => {
815 const ws = new NodeWS.WebSocket(`ws://127.0.0.1:${port}/ws`, { perMessageDeflate })
816 ws.on("open", () => resume(Effect.succeed(ws)))
817 ws.on("error", (error) => resume(Effect.fail(error)))
818 }),
819 (ws) => Effect.sync(() => ws.close())
820 )
821
822 // layerTest configures websocket: { perMessageDeflate: true }, so the
823 // server accepts the extension when the client offers it...

Callers 1

Calls 6

onMethod · 0.65
closeMethod · 0.65
resumeFunction · 0.50
succeedMethod · 0.45
failMethod · 0.45
syncMethod · 0.45

Tested by

no test coverage detected