[API reference](https://jsprismarine.dev/api/index.md) / [@jsprismarine/script-host](https://jsprismarine.dev/api/@jsprismarine/script-host/index.md) / [debugger/channel](https://jsprismarine.dev/api/@jsprismarine/script-host/debugger/channel/index.md) / PortDebuggerChannel

# Class: PortDebuggerChannel

Defined in: [script-host/src/debugger/channel.ts:46](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/script-host/src/debugger/channel.ts#L46)

The engine thread's end: a [DebuggerChannel](https://jsprismarine.dev/api/@jsprismarine/script-host/debugger/DebugSession/index.md#debuggerchannel) whose `receive` blocks the thread until the
connection's side delivers a message or closes.

## Implements

- [`DebuggerChannel`](https://jsprismarine.dev/api/@jsprismarine/script-host/debugger/DebugSession/index.md#debuggerchannel)

## Constructors

### Constructor

> **new PortDebuggerChannel**(`endpoint`): `PortDebuggerChannel`

Defined in: [script-host/src/debugger/channel.ts:50](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/script-host/src/debugger/channel.ts#L50)

#### Parameters

##### endpoint

[`DebuggerChannelEndpoint`](https://jsprismarine.dev/api/@jsprismarine/script-host/debugger/channel/index.md#debuggerchannelendpoint)

#### Returns

`PortDebuggerChannel`

## Accessors

### closed

#### Get Signature

> **get** **closed**(): `boolean`

Defined in: [script-host/src/debugger/channel.ts:56](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/script-host/src/debugger/channel.ts#L56)

Whether the connection's side has closed. Messages it delivered before closing still arrive.

##### Returns

`boolean`

Whether the connection has closed. `receive` and `poll` still return the messages that
arrived before it closed.

#### Implementation of

[`DebuggerChannel`](https://jsprismarine.dev/api/@jsprismarine/script-host/debugger/DebugSession/index.md#debuggerchannel).[`closed`](https://jsprismarine.dev/api/@jsprismarine/script-host/debugger/DebugSession/index.md#closed)

## Methods

### close()

> **close**(): `void`

Defined in: [script-host/src/debugger/channel.ts:82](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/script-host/src/debugger/channel.ts#L82)

Closes this end, which also tells the connection's side.

#### Returns

`void`

***

### poll()

> **poll**(): `unknown`

Defined in: [script-host/src/debugger/channel.ts:77](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/script-host/src/debugger/channel.ts#L77)

Returns a message that has already arrived, or undefined, without waiting.

#### Returns

`unknown`

#### Implementation of

[`DebuggerChannel`](https://jsprismarine.dev/api/@jsprismarine/script-host/debugger/DebugSession/index.md#debuggerchannel).[`poll`](https://jsprismarine.dev/api/@jsprismarine/script-host/debugger/DebugSession/index.md#poll)

***

### receive()

> **receive**(): `unknown`

Defined in: [script-host/src/debugger/channel.ts:66](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/script-host/src/debugger/channel.ts#L66)

Returns the next message, blocking this thread until one arrives; undefined once the connection has closed.

#### Returns

`unknown`

#### Implementation of

[`DebuggerChannel`](https://jsprismarine.dev/api/@jsprismarine/script-host/debugger/DebugSession/index.md#debuggerchannel).[`receive`](https://jsprismarine.dev/api/@jsprismarine/script-host/debugger/DebugSession/index.md#receive)

***

### send()

> **send**(`message`): `void`

Defined in: [script-host/src/debugger/channel.ts:61](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/script-host/src/debugger/channel.ts#L61)

Posts a message to the connection's side; dropped once it has closed.

#### Parameters

##### message

[`HostMessage`](https://jsprismarine.dev/api/@jsprismarine/script-host/debugger/protocol/index.md#hostmessage)

#### Returns

`void`

#### Implementation of

[`DebuggerChannel`](https://jsprismarine.dev/api/@jsprismarine/script-host/debugger/DebugSession/index.md#debuggerchannel).[`send`](https://jsprismarine.dev/api/@jsprismarine/script-host/debugger/DebugSession/index.md#send)
