Skip to content

API reference / @jsprismarine/script-host / debugger/thread / DebuggerThread

Class: DebuggerThread ​

Defined in: script-host/src/debugger/thread.ts:72

The debugger's socket thread. It holds at most one listener and one connection: a new listen or connect closes both first, as Bedrock Dedicated Server's commands replace the debugger they find. The thread starts with the first request and does not keep the process alive.

Constructors ​

Constructor ​

new DebuggerThread(events): DebuggerThread

Defined in: script-host/src/debugger/thread.ts:78

Parameters ​

events ​

DebuggerThreadEvents

Returns ​

DebuggerThread

Methods ​

close() ​

close(): Promise<void>

Defined in: script-host/src/debugger/thread.ts:102

Closes the listener and the connection; the channel's end on this thread then reads as closed.

Returns ​

Promise<void>


connect() ​

connect(options): Promise<void>

Defined in: script-host/src/debugger/thread.ts:97

Connects to an extension that listens, as /script debugger connect does. The DebuggerThreadEvents.connected event comes before this resolves.

Parameters ​

options ​

ConnectOptions

Returns ​

Promise<void>

Throws ​

When the connection fails.


listen() ​

listen(options): Promise<number>

Defined in: script-host/src/debugger/thread.ts:88

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

Parameters ​

options ​

ListenOptions

Returns ​

Promise<number>

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

Throws ​

With Bedrock Dedicated Server's message for an address other than loopback without a passcode, or why the port could not be opened.


terminate() ​

terminate(): Promise<void>

Defined in: script-host/src/debugger/thread.ts:108

Stops the thread, closing whatever it held.

Returns ​

Promise<void>