reckfellENGINE

JsonRpc

A helper to handle dictionaries which look like JSONRPC documents.

On this page
class JsonRpcReckfellSharpInherits ReckfellObject

A helper to handle dictionaries which look like JSONRPC documents.

JSON-RPC is a standard which wraps a method call in a Json object. The object has a particular structure and identifies which method is called, the parameters to that function, and carries an ID to keep track of responses. This class implements that standard on top of Reckfell.Collections.Dictionary; you will have to convert between a Reckfell.Collections.Dictionary and Json with other functions.

Declarations checked against C# SDK 1.0.0. Expand a name to see declarations and documentation.

Constructors1

JsonRpcConstructor
# JsonRpc
C#
public JsonRpc();

Methods8

MakeNotificationReckfell.Collections.Dictionary
# MakeNotification
C#
public Reckfell.Collections.Dictionary MakeNotification(string method, Variant @params);

Returns a dictionary in the form of a JSON-RPC notification. Notifications are one-shot messages which do not expect a response.

  • method: Name of the method being called.
  • params: An array or dictionary of parameters being passed to the method.
Parameters
NameTypeDefault
methodstring—
paramsVariant—
Returns Reckfell.Collections.Dictionary
MakeRequestReckfell.Collections.Dictionary
# MakeRequest
C#
public Reckfell.Collections.Dictionary MakeRequest(string method, Variant @params, Variant id);

Returns a dictionary in the form of a JSON-RPC request. Requests are sent to a server with the expectation of a response. The ID field is used for the server to specify which exact request it is responding to.

  • method: Name of the method being called.
  • params: An array or dictionary of parameters being passed to the method.
  • id: Uniquely identifies this request. The server is expected to send a response with the same ID.
Parameters
NameTypeDefault
methodstring—
paramsVariant—
idVariant—
Returns Reckfell.Collections.Dictionary
MakeResponseReckfell.Collections.Dictionary
# MakeResponse
C#
public Reckfell.Collections.Dictionary MakeResponse(Variant result, Variant id);

When a server has received and processed a request, it is expected to send a response. If you did not want a response then you need to have sent a Notification instead.

  • result: The return value of the function which was called.
  • id: The ID of the request this response is targeted to.
Parameters
NameTypeDefault
resultVariant—
idVariant—
Returns Reckfell.Collections.Dictionary
MakeResponseErrorReckfell.Collections.Dictionary
# MakeResponseError
C#
public Reckfell.Collections.Dictionary MakeResponseError(int code, string message, Variant id = default);

Creates a response which indicates a previous reply has failed in some way.

  • code: The error code corresponding to what kind of error this is. See the JsonRpc.ErrorCode constants.
  • message: A custom message about this error.
  • id: The request this error is a response to.
Parameters
NameTypeDefault
codeint—
messagestring—
idVariantdefault
Returns Reckfell.Collections.Dictionary
ProcessActionVariant
# ProcessAction
C#
public Variant ProcessAction(Variant action, bool recurse = false);

Given a Dictionary which takes the form of a JSON-RPC request: unpack the request and run it. Methods are resolved by looking at the field called "method" and looking for an equivalently named function in the JSONRPC object. If one is found that method is called. To add new supported methods extend the JSONRPC class and call JsonRpc.ProcessAction on your subclass. action: The action to be run, as a Dictionary in the form of a JSON-RPC request or notification.

Parameters
NameTypeDefault
actionVariant—
recurseboolfalse
Returns Variant
ProcessStringstring
# ProcessString
C#
public string ProcessString(string action);
Parameters
NameTypeDefault
actionstring—
Returns string
SetMethodvoid
# SetMethod
C#
public void SetMethod(string name, Callable callback);

Registers a callback for the given method name.

  • name: The name that clients can use to access the callback.
  • callback: The callback which will handle the specified method.
Parameters
NameTypeDefault
namestring—
callbackCallable—
SetScopevoid
# SetScope
C#
public void SetScope(string scope, ReckfellObject target);
Parameters
NameTypeDefault
scopestring—
targetReckfellObject—

JsonRpc.ErrorCode

ValueDescription
InternalError = -32603

An internal error occurred while processing the request. Not used by the built-in JSONRPC.

InvalidParams = -32602

A method call was requested but the given method parameters are not valid. Not used by the built-in JSONRPC.

InvalidRequest = -32600

A method call was requested but the request's format is not valid.

MethodNotFound = -32601

A method call was requested but no function of that name existed in the JSONRPC subclass.

ParseError = -32700

The request could not be parsed as it was not valid by JSON standard (Json.Parse failed).

Reckfell Engine documentationBack to top ↑
QUICK LINKSGetting startedEntity hierarchyC# & .NET 10Scenes and prefabs
Reckfell guides and full API K
reckfellENGINE
RECKFELL ACCOUNT

Sign in

Sign in to your Reckfell account.

One account for the entire Reckfell platform.