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
Adapts a Deno connection into an Effect socket.
Details
Readers over TCP connections can upgrade in place with Deno.startTls.
Deno exposes only the client side of this transition; Unix connections fail
the upgrade with a SocketUpgradeError.
Deno.startTls does not support client certificates, so key, cert,
passphrase, and requestCert do not affect Deno upgrades. Setting
rejectUnauthorized to false disables hostname verification only;
certificate-chain validation still applies.
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 highWaterMark?: number; readonly openTimeout?: Input; readonly protocols?: string | Array<string>;}): 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;}