Attention: Here be dragons
This is the latest
(unstable) version of this documentation, which may document features
not available in or compatible with released stable versions of Godot.
Checking the stable version of the documentation...
JSONRPC¶
Inherits: Object
A helper to handle dictionaries which look like JSONRPC documents.
Description¶
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 Dictionary; you will have to convert between a Dictionary and JSON with other functions.
Methods¶
make_notification ( String method, Variant params ) |
|
make_request ( String method, Variant params, Variant id ) |
|
make_response ( Variant result, Variant id ) |
|
make_response_error ( int code, String message, Variant id=null ) const |
|
process_action ( Variant action, bool recurse=false ) |
|
process_string ( String action ) |
|
void |
Enumerations¶
enum ErrorCode:
ErrorCode PARSE_ERROR = -32700
ErrorCode INVALID_REQUEST = -32600
ErrorCode METHOD_NOT_FOUND = -32601
A method call was requested but no function of that name existed in the JSONRPC subclass.
ErrorCode INVALID_PARAMS = -32602
ErrorCode INTERNAL_ERROR = -32603
Method Descriptions¶
Dictionary make_notification ( 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.
Dictionary make_request ( 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.
Dictionary make_response ( 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 re