|
22 | 22 |
|
23 | 23 | namespace Haeckel\JsonRpcServerContract\Message; |
24 | 24 |
|
25 | | -/** @link https://www.jsonrpc.org/specification#notification */ |
| 25 | +/** |
| 26 | + * A Notification is a Request object without an "id" member. |
| 27 | + * A Request object that is a Notification signifies the Client's lack of interest in the |
| 28 | + * corresponding Response object, and as such no Response object needs to be returned to the client. |
| 29 | + * The Server MUST NOT reply to a Notification, including those that are within a batch request. |
| 30 | + * |
| 31 | + * Notifications are not confirmable by definition, |
| 32 | + * since they do not have a Response object to be returned. |
| 33 | + * As such, the Client would not be aware of any errors |
| 34 | + * (like e.g. "Invalid params","Internal error"). |
| 35 | + * @link https://www.jsonrpc.org/specification#notification |
| 36 | + */ |
26 | 37 | interface NotificationIface extends \JsonSerializable |
27 | 38 | { |
28 | 39 | public function getJsonRpc(): string; |
29 | | - public function withJsonRpc(string $jsonRpc): static; |
| 40 | + /** |
| 41 | + * @param string $jsonrpc |
| 42 | + * A String specifying the version of the JSON-RPC protocol. MUST be exactly "2.0". |
| 43 | + */ |
| 44 | + public function withJsonRpc(string $jsonrpc): static; |
30 | 45 |
|
31 | 46 | public function getMethod(): string; |
| 47 | + /** |
| 48 | + * @param string $method |
| 49 | + * A String containing the name of the method to be invoked. |
| 50 | + * Method names that begin with the word rpc followed by a period character (U+002E or ASCII 46) |
| 51 | + * are reserved for rpc-internal methods and extensions and MUST NOT be used for anything else. |
| 52 | + */ |
32 | 53 | public function withMethod(string $method): static; |
33 | 54 |
|
34 | | - /** @return null|object|array<mixed> */ |
| 55 | + /** @return null|object|list<mixed> */ |
35 | 56 | public function getParams(): null|array|object; |
36 | | - /** @param null|object|array<mixed> $params */ |
| 57 | + /** |
| 58 | + * @param null|object|list<mixed> $params |
| 59 | + * A Structured value that holds the parameter values to be used during the invocation of the |
| 60 | + * method. This member MAY be omitted (in this case with null). |
| 61 | + * |
| 62 | + * If present, parameters for the rpc call MUST be provided as a Structured value. |
| 63 | + * Either by-position through an Array or by-name through an Object. |
| 64 | + * |
| 65 | + * by-position: params MUST be an Array, containing the values in the Server expected order. |
| 66 | + * by-name: params MUST be an Object, with member names that match the Server expected parameter |
| 67 | + * names. The absence of expected names MAY result in an error being generated. |
| 68 | + * The names MUST match exactly, including case, to the method's expected parameters. |
| 69 | + * |
| 70 | + * @link https://www.jsonrpc.org/specification#parameter_structures |
| 71 | + */ |
37 | 72 | public function withParams(null|array|object $params): static; |
38 | 73 | } |
0 commit comments