NodeSocket
Node socket adapters for Effect sockets.
This module opens node:net connections or wraps existing Node Duplex
streams and presents them as Socket.Socket values, socket channels, or
layers. It also exposes the current underlying NetSocket service for code
running inside a socket handler and re-exports the ws package namespace.
Constructors
fromDuplex
Adapts a Node Duplex into a Socket.Socket, wiring data events to socket
handlers, providing a scoped writer, and mapping open, read, write, and close
failures to SocketError.
Signature
declare function fromDuplex<RO>(open: Effect<Duplex, SocketError, RO>, options?: { readonly openTimeout?: any;}): Effect<Socket, never, Exclude<RO, Scope>>Opens a Node TCP connection as an Effect socket.
When to use
Use to create a scoped Socket.Socket from Node net.createConnection.
Details
Supports openTimeout and closes or destroys the underlying socket when the
enclosing scope is finalized.
Signature
declare function makeNet(options: NetConnectOpts & { readonly openTimeout?: any;}): Effect<Socket>makeNetChannel
Creates a Channel over a TCP socket, reading arrays of Uint8Array
chunks and writing arrays of bytes, strings, or socket close events.
Signature
declare function makeNetChannel<IE = never>(options: NetConnectOpts): Channel<NonEmptyReadonlyArray<Uint8Array<ArrayBufferLike>>, any, void, NonEmptyReadonlyArray<any>, IE>Layers
Re-Exports
NodeWS
Signature
declare const NodeWS: any