jsonrpc: expose encoding and decoding functions (#114)
Expose `jsonrpc2.MakeID`, `jsonrpc2.EncodeMessage` and `jsonrpc2.DecodeMessage` functions to allow implementing custom `mcp.Transport`. Add an example that demonstrates a custom transport implementation. Fixes #110.
This commit is contained in:
parent
aa9d4b28be
commit
fe208c144f
1 changed files with 129 additions and 1 deletions
|
|
@ -19,7 +19,7 @@ type ID struct {
|
|||
// MakeID coerces the given Go value to an ID. The value is assumed to be the
|
||||
// default JSON marshaling of a Request identifier -- nil, float64, or string.
|
||||
//
|
||||
// Returns an error if the value type was a valid Request ID type.
|
||||
// Returns an error if the value type was not a valid Request ID type.
|
||||
//
|
||||
// TODO: ID can't be a json.Marshaler/Unmarshaler, because we want to omitzero.
|
||||
// Simplify this package by making ID json serializable once we can rely on
|
||||
|
|
|
|||
Loading…
Reference in a new issue