DenoSocket
Native Deno socket adapters for Effect sockets.
This module uses Deno-specific names: makeTcp, makeTcpChannel, layerTcp, and fromConn correspond to the Node platform's net and duplex APIs. Deno does not support keepAliveInitialDelay, and the noDelay and keepAlive options have no effect on Unix connections. A CloseEvent always closes gracefully because Deno has no equivalent of Node's reset-on-close.
Constructors
Signature
declare function fromConn<RO>( open: Effect<Conn, SocketError, RO>,): Effect<Socket, never, Exclude<RO, Scope>>;Opens a native Deno TCP or Unix connection as an Effect socket.
Details
An openTimeout interrupts acquisition but cannot cancel the in-flight Deno.connect promise. The scope finalizer closes a connection that arrives after the timeout.
Signature
declare function makeTcp(options: any): Effect<Socket>;makeTcpChannel
Creates a channel over a native Deno TCP or Unix connection.
Signature
declare function makeTcpChannel<IE = never>( options: any,): Channel< readonly [Uint8Array<ArrayBufferLike>, Uint8Array<ArrayBufferLike>], SocketError | IE, void, readonly [ string | Uint8Array<ArrayBufferLike> | CloseEvent, string | Uint8Array<ArrayBufferLike> | CloseEvent, ], IE>;Layers
Provides a socket by opening a native Deno TCP or Unix connection.
Signature
declare const layerTcp: (options: ConnectOptions) => Layer.Layer<Socket.Socket, Socket.SocketError>;layerWebSocket
Creates a socket layer connected to a URL with Deno's global WebSocket.
Signature
declare function layerWebSocket( url: string, options?: { readonly closeCodeIsError?: (code: number) => boolean; },): Layer<Socket>;layerWebSocketConstructor
Provides the WebSocket constructor backed by globalThis.WebSocket.
Signature
declare const layerWebSocketConstructor: Layer.Layer<Socket.WebSocketConstructor>;Options
ConnectOptions type
Options for opening a TCP or Unix connection.
Signature
type ConnectOptions = | Deno.ConnectOptions | (Deno.UnixConnectOptions & { readonly keepAlive?: boolean; readonly noDelay?: boolean; });TcpOptions type
Options for opening a TCP or Unix connection.
Signature
type TcpOptions = ConnectOptions & { readonly openTimeout?: Duration.Input;};
Adapts a Deno connection into an Effect socket.