NodeSocket
Node.js socket constructors and layers for Effect sockets.
This module re-exports the shared Node socket support for TCP connections,
Unix domain socket connections, and Node Duplex streams. It also provides
WebSocket constructor layers: one that uses globalThis.WebSocket when
present and falls back to ws, one that always uses ws, and one that
creates a Socket.Socket layer for a WebSocket URL.
Layers
layerWebSocket
Creates a Socket.Socket layer for a WebSocket URL using the Node WebSocket
constructor layer, honoring protocol, open-timeout, and high-water-mark
options.
Signature
declare const layerWebSocket: (url: string | Effect.Effect<string>, options?: { readonly highWaterMark?: number; readonly openTimeout?: Duration.Input; readonly protocols?: string | Array<string>;}) => Layer.Layer<Socket.Socket, never, never>layerWebSocketConstructor
Provides a Socket.WebSocketConstructor, using globalThis.WebSocket when
available and falling back to the ws package otherwise.
Signature
declare const layerWebSocketConstructor: Layer.Layer<Socket.WebSocketConstructor>layerWebSocketConstructorWS
Provides a Socket.WebSocketConstructor backed explicitly by the ws
package.
Signature
declare const layerWebSocketConstructorWS: Layer.Layer<Socket.WebSocketConstructor>