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

Function makeWebSocketChannel

packages/effect/src/socket/Socket.ts:1247–1266  ·  view source on GitHub ↗
(
  url: string,
  options?: {
    readonly openTimeout?: Duration.Input | undefined
    readonly protocols?: string | Array<string> | undefined
    readonly headers?: Readonly<Record<string, string>> | undefined
    readonly highWaterMark?: number | undefined
  }
)

Source from the content-addressed store, hash-verified

1245 * @since 4.0.0
1246 */
1247export const makeWebSocketChannel = <IE = never>(
1248 url: string,
1249 options?: {
1250 readonly openTimeout?: Duration.Input | undefined
1251 readonly protocols?: string | Array<string> | undefined
1252 readonly headers?: Readonly<Record<string, string>> | undefined
1253 readonly highWaterMark?: number | undefined
1254 }
1255): Channel.Channel<
1256 NonEmptyReadonlyArray<Uint8Array>,
1257 SocketError | IE,
1258 void,
1259 NonEmptyReadonlyArray<Uint8Array | string | CloseEvent>,
1260 IE,
1261 unknown,
1262 WebSocketConstructor
1263> =>
1264 Channel.unwrap(
1265 Effect.map(makeWebSocket(url, options), toChannelWith<IE>())
1266 )
1267
1268/**
1269 * Layer that provides a `Socket` service backed by a WebSocket URL or URL

Callers

nothing calls this directly

Calls 3

toChannelWithFunction · 0.85
makeWebSocketFunction · 0.70
mapMethod · 0.45

Tested by

no test coverage detected