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
-
JrpcConv, PreferredOutputType, Reader, Writer, automaticBuiltinSerialization, automaticPrimitivesSerialization, automaticSerialization, decode, flavorAllowsUnknownFields, flavorEnumRep, flavorEnumRep, flavorOmitsOptionalFields, flavorRequiresAllFields, flavorSkipNullFields, flavorUsesAutomaticObjectSerialization, mimeType, typeAutoSerialize, typeClassOrMemberAutoSerialize, $, ==, BidiMessage, BidiMessageKind, BidiMessageRequestError, BidiMessageResponseError, InvalidRequestSysError, JrpcSys, JsonRPC2, ParamDescNamed, ParamDescRx, PreferredOutputType, Reader, ReBatchKind, ReqRespHeader, RequestBatchRx, RequestId, RequestIdKind, RequestParamKind, RequestParamsRx, RequestParamsTx, RequestRx, RequestRx2, RequestTx, ResponseBatchRx, ResponseError, ResponseKind, ResponseRx, ResponseRx2, ResponseTx, Writer, automaticBuiltinSerialization, automaticPrimitivesSerialization, automaticSerialization, decode, flavorAllowsUnknownFields, flavorEnumRep, flavorEnumRep, flavorOmitsOptionalFields, flavorRequiresAllFields, flavorSkipNullFields, flavorUsesAutomaticObjectSerialization, hash, isFieldExpected, meth, meth, mimeType, readValue, readValue, readValue, readValue, readValue, readValue, readValue, readValue, readValue, readValue, readValue, readValue, readValue, shouldWriteObjectField, toTx, typeAutoSerialize, typeClassOrMemberAutoSerialize, withWriter, writeNotification, writeRequest, writeValue, writeValue, writeValue, writeValue, writeValue, writeValue, writeValue