Skip to content

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

Class: DebuggerSocket ​

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

One TCP connection to the extension, framed in both directions.

Constructors ​

Constructor ​

new DebuggerSocket(socket): DebuggerSocket

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

Wraps a connected socket.

Parameters ​

socket ​

Socket

Returns ​

DebuggerSocket

Accessors ​

closed ​

Get Signature ​

get closed(): boolean

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

Whether the connection has closed.

Returns ​

boolean


peer ​

Get Signature ​

get peer(): object

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

The extension's end of the connection: its IP address and port.

Returns ​

object

address ​

readonly address: string

port ​

readonly port: number

Methods ​

close() ​

close(): void

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

Closes the connection once what was sent has gone. It ends this side and keeps reading until the extension closes its own, which it does on seeing the end. Destroying the socket at once would close it with the extension's last frames unread, and the reset that sends can make the extension discard what arrived just before it, such as the line saying why the handshake was refused. A peer that keeps its own side open is cut off after CLOSE_GRACE_MS.

Returns ​

void


onClose() ​

onClose(listener): void

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

Calls listener once when the connection closes, with the error that closed it if any.

Parameters ​

listener ​

(error) => void

Returns ​

void


onMessage() ​

onMessage(listener): void

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

Calls listener with each message the extension sends, in order.

Parameters ​

listener ​

(message) => void

Returns ​

void


send() ​

send(message): void

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

Sends one message.

Parameters ​

message ​

unknown

Returns ​

void