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

# debugger/framing

## Classes

- [FrameDecoder](https://jsprismarine.dev/api/@jsprismarine/script-host/debugger/framing/classes/FrameDecoder.md)

## Variables

### FRAME\_HEADER\_BYTES

> `const` **FRAME\_HEADER\_BYTES**: `9` = `9`

Defined in: [script-host/src/debugger/framing.ts:11](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/script-host/src/debugger/framing.ts#L11)

The bytes of a frame's length header: 8 hexadecimal digits and a newline.

***

### MAX\_FRAME\_LENGTH

> `const` **MAX\_FRAME\_LENGTH**: `4294967295` = `0xffffffff`

Defined in: [script-host/src/debugger/framing.ts:14](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/script-host/src/debugger/framing.ts#L14)

The largest length a header can state, its body's JSON and newline together.

***

### MAX\_RECEIVED\_FRAME\_LENGTH

> `const` **MAX\_RECEIVED\_FRAME\_LENGTH**: `number`

Defined in: [script-host/src/debugger/framing.ts:24](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/script-host/src/debugger/framing.ts#L24)

The largest body the host reads from the extension: 1 MiB. The extension's messages are small,
and the largest carry what a person writes: an `evaluate` expression, a command, or one file's
breakpoint lines in `setBreakpoints`. A breakpoint list reaches the engine through its transfer
buffer, `DEFAULT_BUFFER_SIZE` (64 KiB) unless an engine sets another size, and the limit is 16
times that, which leaves room for a pasted expression. A peer has given no passcode before its
first message decodes, so a header that states more is refused before its body is buffered.

## Functions

### encodeFrame()

> **encodeFrame**(`message`): `Buffer`

Defined in: [script-host/src/debugger/framing.ts:31](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/script-host/src/debugger/framing.ts#L31)

Frames one message.

#### Parameters

##### message

`unknown`

The message, which JSON can encode.

#### Returns

`Buffer`

The header, the JSON and its trailing newline.
