JsonRpcMessage Type
One JSON-RPC message the peer sent that is **not** an answer to a request this session made: a notification (no `id`), or a request the peer wants answered (`id` present, so `IsRequest` is true — LSP servers use these for `workspace/configuration`, `window/showMessageRequest`, and similar call-backs). Answers to this session's own requests never appear here: they are routed straight to the `RequestAsync` call waiting on them. The message is kept as raw JSON text rather than a deserialized value, because only the caller knows what type a given `method` carries. Use `ParamsAs<'T>` for a typed read, or `ParamsJson`/`Payload` to handle it by hand.
Instance members
| Instance member |
Description
|
Full Usage:
this.Id
Returns: string option
|
The peer's `id`, as the raw JSON text it sent (`7`, `"abc"`, or the literal `null` — JSON-RPC 2.0 allows a null id on a request), or `None` when the message carried no `id` member at all (a notification). `RespondAsync`/`RespondErrorAsync` echo it back byte-for-byte, which is what the peer correlates its own pending call against.
|
Full Usage:
this.IsRequest
Returns: bool
|
True when the peer expects an answer (the message carried an `id`) — answer it with `RespondAsync` or `RespondErrorAsync`. False for a notification, which must not be answered.
|
Full Usage:
this.Method
Returns: string
|
The `method` member — what the peer is notifying about or asking for.
|
Full Usage:
this.ParamsAs
Parameters:
JsonSerializerOptions
Returns: Result<'T, ProcessError>
Type parameters: 'T |
Deserialize `params` into a `'T` via reflection-based `System.Text.Json` (`options` omitted uses the BCL defaults). Same missing-/malformed-params contract as the `JsonTypeInfo` overload. **Trimming / AOT:** not trim-/AOT-safe — pass a `JsonTypeInfo<'T>` through the other overload in a trimmed/NativeAOT app.
|
Full Usage:
this.ParamsAs
Parameters:
JsonTypeInfo<'T>
Returns: Result<'T, ProcessError>
Type parameters: 'T |
Deserialize `params` into a `'T` using source-generated `JsonTypeInfo<'T>` metadata, so this overload is safe for trimmed and NativeAOT applications. A message with no `params`, or one whose `params` do not fit `'T`, is `ProcessError.Parse` — never a raw exception.
|
Full Usage:
this.ParamsJson
Returns: string option
|
The raw JSON text of the `params` member; `None` when the message carried none.
|
Full Usage:
this.Payload
Returns: byte[]
|
The frame this message was decoded from, byte-exact — for logging, or for a hand-rolled read of members this type does not surface.
|
ProcessKit API Reference