We use cookies to improve your experience.

Cookie Policy
Logo of Lexmount
DocsTemplatesBlogHelp Center
GitHub
Logo of LexmountLexmount Browser

Get started

Lexmount Documentation
Console guide

Browser

Web Fetch

OverviewQuick Start
Common Errors

Web Search

OverviewQuick StartSearch API

Runtime

OverviewQuickstart
Overviewfetchlexmount:env
Overviewhost.fshost.fetchhost.processhost.tcphost.http
lexmount:browser
Examples

Help and billing

Capability FAQ
ChangelogContact support
API Referencelexmount:remote

host.tcp

Connect and listen for TCP connections on a client.

The TCP interface creates outbound connections and listeners on the selected client, with byte streams for reading and writing.

Here, host is a selected RemoteHost; see host discovery to obtain one. The module overview covers permissions and shared errors.

TCP requires tcp.enabled. A TcpAddress has read-only hostname: string and port: number fields.

host.tcp.connect(options)

Function: establishes a TCP connection from the client.

Parameters: required options, containing optional hostname: string (default 127.0.0.1) and required port: number (integer 1–65535).

Return value: Promise<TcpConnection>.

host.tcp.listen(options?)

Function: listens for TCP connections on the client.

Parameters: optional { hostname?: string; port?: number }, default 127.0.0.1:0. Port is an integer 0–65535; 0 allocates a free port.

Return value: Promise<TcpListener>.

TcpConnection

PropertyTypeDescription
localAddr, remoteAddrReadonly<TcpAddress>Local and remote addresses
readableReadableStream<Uint8Array>Reads bytes; cancel closes the whole connection
writableWritableStream<Uint8Array>Writes bytes; close sends write EOF only, abort closes the whole connection
closedPromise<void>Resolves when the connection ends, rejects on remote failure

connection.close() takes no arguments and returns Promise<void>. It closes the whole connection and is safe to repeat.

TcpListener

Read-only addr: Readonly<TcpAddress> is the actual listening address. finished: Promise<void> represents listener completion.

MethodFunctionParametersReturn value
listener.accept()Wait for one connection; only one pending call is allowedNonePromise<TcpConnection | null>; null after explicit close, rejects on listener failure
listener.close()Stop accepting; existing connections remain independentNonePromise<void>
listener[Symbol.asyncIterator]()Iterate connections with for awaitNoneAsyncIterator<TcpConnection>; leaving iteration closes the listener

See remote.d.ts for type declarations.

host.process

Query client processes, run commands, and control streaming child processes.

host.http

Listen for HTTP requests on a client and handle them in the cloud runtime.

Table of Contents

host.tcp.connect(options)
host.tcp.listen(options?)
TcpConnection
TcpListener

Still need help?Ask on Discord