-
Notifications
You must be signed in to change notification settings - Fork 456
Update actions/events communication format to JSON-RPC #5918
Comments
Request object
jsonrpc:A String specifying the version of the JSON-RPC protocol. MUST be exactly "2.0". method:A String containing the name of the method to be invoked. Method names that begin with the word rpc followed by a period character (U+002E or ASCII 46) are reserved for rpc-internal methods and extensions and MUST NOT be used for anything else. params:A Structured value that holds the parameter values to be used during the invocation of the method. This member MAY be omitted. id:An identifier established by the Client that MUST contain a String, Number, or NULL value if included. If it is not included it is assumed to be a notification. The value SHOULD normally not be Null [1] and Numbers SHOULD NOT contain fractional parts [2] |
Response object
jsonrpc:A String specifying the version of the JSON-RPC protocol. MUST be exactly "2.0". resultThis member is REQUIRED on success. errorThis member is REQUIRED on error. idThis member is REQUIRED. |
BatchTo send several Request objects at the same time, the Client MAY send an Array filled with Request objects. The Server should respond with an Array containing the corresponding Response objects, after all of the batch Request objects have been processed. A Response object SHOULD exist for each Request object, except that there SHOULD NOT be any Response objects for notifications. The Server MAY process a batch rpc call as a set of concurrent tasks, processing them in any order and with any width of parallelism. The Response objects being returned from a batch call MAY be returned in any order within the Array. The Client SHOULD match contexts between the set of Request objects and the resulting set of Response objects based on the id member within each Object. If the batch rpc call itself fails to be recognized as an valid JSON or as an Array with at least one value, the response from the Server MUST be a single Response object. If there are no Response objects contained within the Response array as it is to be sent to the client, the server MUST NOT return an empty Array and should return nothing at all.
|
NotificationA Notification is a Request object without an "id" member. A Request object that is a Notification signifies the Client's lack of interest in the corresponding Response object, and as such no Response object needs to be returned to the client. The Server MUST NOT reply to a Notification, including those that are within a batch request. Notifications are not confirmable by definition, since they do not have a Response object to be returned. As such, the Client would not be aware of any errors (like e.g. "Invalid params","Internal error"). Request
No response |
Error objectWhen a rpc call encounters an error, the Response Object MUST contain the error member with a value that is a Object with the following members: code The error codes from and including -32768 to -32000 are reserved for pre-defined errors. Any code within this range, but not defined explicitly below is reserved for future use
|
Update actions/events communication format to JSON-RPC - Closes #5918
Description
Update communication schema of actions and events to be in the format of JSON-RPC v2 referencing in
action.ts
andevent.ts
Motivation
Enable message communication to be transport agnostic by introducing JSON-RPC.
JSON-RPC node communication is a standard in the industry, and as actions and events are going to be exposed for API client, it should follow the standard.
Why update only the action and events format to JSONRPC?
Why the new APIClients IPC/WS does not respond in JSONRPC format?
Acceptance Criteria
invoke
,subscribe
function interface should not be changed.Additional Information
Related issue #5919
The text was updated successfully, but these errors were encountered: