Response
extends Message
in package
AbstractYes
When a rpc call is made, the Server MUST reply with a Response, except for in the case of Notifications. The Response is expressed as a single JSON Object, with the following members:
Table of Contents
Properties
- $id : int|string
- This member is REQUIRED. It MUST be the same as the value of the id member in the Request Object. If there was an error in detecting the id in the Request object (e.g. Parse error/Invalid Request), it MUST be Null.
- $jsonrpc : string
- A String specifying the version of the JSON-RPC protocol. MUST be exactly "2.0".
Methods
- __construct() : mixed
- __toString() : string
- isResponse() : bool
- A message is considered a Response if it has an ID and either a result or an error
- parse() : Message
- Returns the appropriate Message subclass
Properties
$id
This member is REQUIRED. It MUST be the same as the value of the id member in the Request Object. If there was an error in detecting the id in the Request object (e.g. Parse error/Invalid Request), it MUST be Null.
public
int|string
$id
$jsonrpc
A String specifying the version of the JSON-RPC protocol. MUST be exactly "2.0".
public
string
$jsonrpc
= '2.0'
Methods
__construct()
public
__construct(int|string $id) : mixed
Parameters
- $id : int|string
__toString()
public
__toString() : string
Return values
stringisResponse()
A message is considered a Response if it has an ID and either a result or an error
public
static isResponse(object $msg) : bool
Parameters
- $msg : object
-
A decoded message body
Return values
boolparse()
Returns the appropriate Message subclass
public
static parse(string $msg) : Message
Parameters
- $msg : string