BunSocket
Bun platform socket entry point for Effect sockets.
This module re-exports the shared Node socket constructors for TCP clients,
Unix domain socket clients, and adapters from existing Node Duplex streams.
It also provides Bun WebSocket layers using globalThis.WebSocket, including
a constructor layer and a Socket.Socket layer for a WebSocket URL.
Layers
layerWebSocket
Added in v4.0.0
Source
Creates a Socket.Socket layer for a WebSocket URL using Bun's global
WebSocket constructor, honoring protocol, open-timeout, and
high-water-mark options.
Signature
declare const layerWebSocket: (url: string | Effect<string>, options?: { readonly highWaterMark?: number; readonly openTimeout?: Duration.Input; readonly protocols?: string | Array<string>;}) => Layer.Layer<Socket.Socket, never, never>layerWebSocketConstructor
Added in v4.0.0
Source
Provides a Socket.WebSocketConstructor backed by Bun's global
WebSocket implementation.
Signature
declare const layerWebSocketConstructor: Layer.Layer<Socket.WebSocketConstructor>