SuccessResponse
extends Response
in package
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".
- $result : mixed
- This member is REQUIRED on success. This member MUST NOT exist if there was an error invoking the method. The value of this member is determined by the method invoked on the Server.
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
- isSuccessResponse() : bool
- A message is considered a SuccessResponse if it has an ID and either a result
- 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'
$result
This member is REQUIRED on success. This member MUST NOT exist if there was an error invoking the method. The value of this member is determined by the method invoked on the Server.
public
mixed
$result
Methods
__construct()
public
__construct(int|string $id, mixed $result) : mixed
Parameters
- $id : int|string
- $result : mixed
__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
boolisSuccessResponse()
A message is considered a SuccessResponse if it has an ID and either a result
public
static isSuccessResponse(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