Skip to content

lspeasy / core/src / serializeMessage

Function: serializeMessage()

ts
function serializeMessage(message): Buffer;

Defined in: packages/core/src/jsonrpc/framing.ts:128

Serializes a JSON-RPC 2.0 message into a framed byte buffer with Content-Length and Content-Type headers.

Parameters

ParameterTypeDescription
messageMessageThe JSON-RPC message to serialize.

Returns

Buffer

A Buffer containing the complete framed message ready for I/O.

Remarks

Counterpart of parseMessage. Used internally by Node.js transports. The output format is: Content-Length: <n>\r\nContent-Type: application/vscode-jsonrpc; charset=utf-8\r\n\r\n<json>.

Released under the MIT License.