Skip to content

SocketServer.ts

Service contract for servers that accept socket connections.

SocketServer exposes the bound server address and a long-running run loop that hands each accepted connection to a handler as a Socket.Socket. The module also defines TCP and Unix socket address models plus the server-level errors reported while opening or running a server. Platform layers provide concrete implementations of this service.

Since v4.0.0



Tagged socket server error that wraps a server error reason and exposes its cause.

Signature

declare class SocketServerError {
constructor(props: { readonly reason: SocketServerErrorReason })
}

Source

Since v4.0.0

Marks this value as a socket server error for runtime guards.

Signature

readonly [ErrorTypeId]: "@effect/platform/SocketServer/SocketServerError"

Source

Since v4.0.0

Union of socket server error reasons.

Signature

type SocketServerErrorReason = SocketServerOpenError | SocketServerUnknownError

Source

Since v4.0.0

Error reason for failures that occur while opening a socket server.

Signature

declare class SocketServerOpenError

Source

Since v4.0.0

Error reason for uncategorized socket server failures.

Signature

declare class SocketServerUnknownError

Source

Since v4.0.0

Socket server address, either a TCP host and port or a Unix socket path.

Signature

type Address = UnixAddress | TcpAddress

Source

Since v4.0.0

TCP socket server address with hostname and port.

Signature

export interface TcpAddress {
readonly _tag: "TcpAddress"
readonly hostname: string
readonly port: number
}

Source

Since v4.0.0

Unix socket server address identified by a filesystem path.

Signature

export interface UnixAddress {
readonly _tag: "UnixAddress"
readonly path: string
}

Source

Since v4.0.0

Context service for a socket server, exposing its bound address and a run loop that handles each accepted Socket.

Signature

declare class SocketServer

Source

Since v4.0.0

Runtime type identifier attached to SocketServerError values.

Signature

declare const ErrorTypeId: "@effect/platform/SocketServer/SocketServerError"

Source

Since v4.0.0

Type-level identifier used to mark SocketServerError values.

Signature

type ErrorTypeId = "@effect/platform/SocketServer/SocketServerError"

Source

Since v4.0.0