Skip to content

API reference / @jsprismarine/script-host / debugger/transport

debugger/transport ​

Classes ​

Interfaces ​

ConnectOptions ​

Defined in: script-host/src/debugger/transport.ts:190

Where an extension in listen mode waits.

Properties ​

host? ​

readonly optional host?: string

Defined in: script-host/src/debugger/transport.ts:191

port? ​

readonly optional port?: number

Defined in: script-host/src/debugger/transport.ts:192


DebuggerListener ​

Defined in: script-host/src/debugger/transport.ts:144

A listener waiting for the extension to connect. It takes one connection, then stops listening.

Properties ​

address ​

readonly address: AddressInfo

Defined in: script-host/src/debugger/transport.ts:146

The address and port it listens on, which tells the port when 0 asked for any.

connection ​

readonly connection: Promise<DebuggerSocket>

Defined in: script-host/src/debugger/transport.ts:148

The connection, once the extension makes it; rejected when the listener closes first.

Methods ​

close() ​

close(): void

Defined in: script-host/src/debugger/transport.ts:150

Stops waiting.

Returns ​

void


ListenOptions ​

Defined in: script-host/src/debugger/transport.ts:137

Where to listen for the extension, and the passcode a non-loopback address requires.

Properties ​

address? ​

readonly optional address?: string

Defined in: script-host/src/debugger/transport.ts:139

passcode? ​

readonly optional passcode?: string

Defined in: script-host/src/debugger/transport.ts:140

port? ​

readonly optional port?: number

Defined in: script-host/src/debugger/transport.ts:138

Variables ​

DEFAULT_LISTEN_ADDRESS ​

const DEFAULT_LISTEN_ADDRESS: "127.0.0.1" = '127.0.0.1'

Defined in: script-host/src/debugger/transport.ts:18

The address a listener binds when none is given, as script-debugger-listen-address defaults.

Functions ​

checkListenAddress() ​

checkListenAddress(address, passcode): void

Defined in: script-host/src/debugger/transport.ts:40

Applies Bedrock Dedicated Server's rule for listeners: one on an address other machines can reach needs a passcode.

Parameters ​

address ​

string

passcode ​

string | undefined

Returns ​

void

Throws ​

With the server's message when the address is not loopback and the passcode is empty.


connectToDebugger() ​

connectToDebugger(options?): Promise<DebuggerSocket>

Defined in: script-host/src/debugger/transport.ts:199

Connects to an extension that listens, as /script debugger connect does.

Parameters ​

options? ​

ConnectOptions = {}

Returns ​

Promise<DebuggerSocket>

Throws ​

When the connection fails.


isLoopbackAddress() ​

isLoopbackAddress(address): boolean

Defined in: script-host/src/debugger/transport.ts:24

Whether an address only reaches this machine: localhost, 127.0.0.0/8, ::1, or an IPv4 loopback address mapped into IPv6.

Parameters ​

address ​

string

Returns ​

boolean


listenForDebugger() ​

listenForDebugger(options?): Promise<DebuggerListener>

Defined in: script-host/src/debugger/transport.ts:157

Listens for the extension, as /script debugger listen does.

Parameters ​

options? ​

ListenOptions = {}

Returns ​

Promise<DebuggerListener>

Throws ​

When the address is not loopback and no passcode is set, or it cannot listen.