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

Method write

packages/platform/bun/src/BunHttpServer.ts:565–576  ·  view source on GitHub ↗
(chunk: Uint8Array | string | Socket.CloseEvent)

Source from the content-addressed store, hash-verified

563 }
564 resume(Effect.map(Deferred.await(deferred), (ws) => {
565 const write = (chunk: Uint8Array | string | Socket.CloseEvent) =>
566 Effect.sync(() => {
567 if (typeof chunk === "string") {
568 ws.sendText(chunk)
569 } else if (Socket.isCloseEvent(chunk)) {
570 ws.close(chunk.code, chunk.reason)
571 } else {
572 ws.sendBinary(chunk)
573 }
574
575 return true
576 })
577 const writer = Effect.succeed(write)
578 const runRaw = Effect.fnUntraced(
579 function*<R, E, _>(

Callers

nothing calls this directly

Calls 2

closeMethod · 0.65
syncMethod · 0.45

Tested by

no test coverage detected