Consts
INTERNAL_ERROR = -32603
- Source Edit
INVALID_PARAMS = -32602
- Source Edit
INVALID_REQUEST = -32600
- Source Edit
JSON_ENCODE_ERROR = -32001
- Source Edit
JSON_PARSE_ERROR = -32700
- Source Edit
METHOD_NOT_FOUND = -32601
- Source Edit
SERVER_ERROR = -32000
- Source Edit
Procs
proc route(router: RpcRouter; data: string | seq[byte]): InternalRaisesFuture[ string, void] {....stackTrace: false, raises: [], gcsafe, raises: [], gcsafe.}
-
Route to RPC from string data.
data must be a valid JSON-RPC request or batch request.
Returns the JSON-encoded response.
Source Edit proc route(router: RpcRouter; req: RequestRx2): InternalRaisesFuture[ResponseTx, void] {....stackTrace: false, raises: [], gcsafe, raises: [], gcsafe, tags: [RootEffect], forbids: [].}
- Source Edit
proc route(router: RpcRouter; request: RequestBatchRx): InternalRaisesFuture[ seq[byte], void] {....stackTrace: false, raises: [], gcsafe, raises: [], gcsafe, tags: [RootEffect], forbids: [].}
- Routes the request(s) requests and encodes the responses encoded as JSON Source Edit
Macros
macro rpc(server: RpcRouter; path: static[string]; formatType, body: untyped): untyped {..}
-
Define a remote procedure call. Input and return parameters are defined using the do notation. For example:
myServer.rpc("path") do(param1: int, param2: float) -> string: result = $param1 & " " & $param2
Input parameters are automatically marshalled from json to Nim types, and output parameters are automatically marshalled to json for transport.
Source Edit
Exports
-
Reader, typeClassOrMemberAutoSerialize, decode, automaticBuiltinSerialization, automaticPrimitivesSerialization, flavorEnumRep, flavorEnumRep, flavorRequiresAllFields, typeAutoSerialize, flavorOmitsOptionalFields, Writer, flavorSkipNullFields, automaticSerialization, flavorUsesAutomaticObjectSerialization, PreferredOutputType, flavorAllowsUnknownFields, JrpcConv, mimeType, decode, $, Reader, typeClassOrMemberAutoSerialize, ==, readValue, ResponseBatchRx, writeValue, RequestTx, automaticBuiltinSerialization, writeValue, ResponseError, automaticPrimitivesSerialization, flavorEnumRep, ParamDescNamed, flavorEnumRep, readValue, RequestRx, RequestId, toTx, BidiMessageResponseError, readValue, readValue, RequestRx2, readValue, BidiMessage, readValue, readValue, typeAutoSerialize, ReBatchKind, JsonRPC2, flavorOmitsOptionalFields, flavorRequiresAllFields, RequestParamKind, writeValue, hash, RequestParamsTx, writeValue, Writer, flavorSkipNullFields, BidiMessageRequestError, ResponseRx, readValue, automaticSerialization, ResponseRx2, flavorUsesAutomaticObjectSerialization, writeValue, writeValue, BidiMessageKind, meth, readValue, ResponseTx, RequestParamsRx, writeValue, ResponseKind, ReqRespHeader, readValue, writeRequest, writeNotification, shouldWriteObjectField, ParamDescRx, readValue, PreferredOutputType, withWriter, InvalidRequestSysError, flavorAllowsUnknownFields, RequestBatchRx, readValue, mimeType, readValue, isFieldExpected, meth, RequestIdKind, JrpcSys