[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) / DebuggerChannelBridge

# Class: DebuggerChannelBridge

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

The connection thread's end of a channel. It delivers the extension's messages to the engine's
thread and hands back what the session sends.

## Constructors

### Constructor

> **new DebuggerChannelBridge**(): `DebuggerChannelBridge`

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

#### Returns

`DebuggerChannelBridge`

## Properties

### endpoint

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

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

The end to pass to the engine's thread, where a [PortDebuggerChannel](https://jsprismarine.dev/api/@jsprismarine/script-host/debugger/channel/classes/PortDebuggerChannel.md) wraps it.

## Accessors

### closed

#### Get Signature

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

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

Whether either end has closed.

##### Returns

`boolean`

## Methods

### close()

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

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

Tells the engine's thread the connection closed, after the messages already delivered.

#### Returns

`void`

***

### connect()

> **connect**(`connection`): `void`

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

Joins a connection to this bridge: the extension's messages go to the engine's thread, the
session's go to the extension, and either side closing closes the other.

#### Parameters

##### connection

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

#### Returns

`void`

***

### deliver()

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

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

Hands one message from the extension to the engine's thread, waking it if it waits.

#### Parameters

##### message

`unknown`

#### Returns

`void`

***

### onClose()

> **onClose**(`listener`): `void`

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

Calls `listener` once when the engine's end closes.

#### Parameters

##### listener

() => `void`

#### Returns

`void`

***

### onMessage()

> **onMessage**(`listener`): `void`

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

Calls `listener` with each message the session sends, on this thread's event loop.

#### Parameters

##### listener

(`message`) => `void`

#### Returns

`void`
