Skip to main content

Module message

Module message 

Source
Expand description

The msgpack-rpc envelope.

Every frame holds one message, a MessagePack array:

MessageShape
request[0, id, method, params]
response[1, id, error, result]
notification[2, method, params]

params is an array of arguments, as msgpack-rpc specifies. lsdocs methods take one argument (the params struct), or none when the params type is (). A response has a nil error and a result on success, or an RpcError map and a nil result on failure.

Decoding does not decode the params or result: they are handed on as raw MessagePack so the receiver can decode straight into its typed value.

Structs§

CodecError
Why a frame could not be decoded or a value encoded.

Enums§

Message
A decoded message. Params and results stay encoded.

Functions§

decode
Decodes one frame.
encode_error
Encodes an error response.
encode_notification
Encodes a notification.
encode_request
Encodes a request.
encode_response
Encodes a successful response.
encode_response_raw
Encodes a successful response whose result is already encoded.
peek_request_id
The id of a request frame, if frame looks like a request. Used to answer a request whose params could not be decoded.