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

Function makeWebSocketChannel

packages/effect/src/unstable/socket/Socket.ts:769–785  ·  view source on GitHub ↗
(
  url: string,
  options?: {
    readonly closeCodeIsError?: (code: number) => boolean
  }
)

Source from the content-addressed store, hash-verified

767 * @since 4.0.0
768 */
769export const makeWebSocketChannel = <IE = never>(
770 url: string,
771 options?: {
772 readonly closeCodeIsError?: (code: number) => boolean
773 }
774): Channel.Channel<
775 NonEmptyReadonlyArray<Uint8Array>,
776 SocketError | IE,
777 void,
778 NonEmptyReadonlyArray<Uint8Array | string | CloseEvent>,
779 IE,
780 unknown,
781 WebSocketConstructor
782> =>
783 Channel.unwrap(
784 Effect.map(makeWebSocket(url, options), toChannelWith<IE>())
785 )
786
787/**
788 * Layer that provides a `Socket` service backed by a WebSocket URL or URL

Callers

nothing calls this directly

Calls 3

makeWebSocketFunction · 0.85
toChannelWithFunction · 0.85
mapMethod · 0.45

Tested by

no test coverage detected