0

The client request was good, but the server response was bad. Should the client respond to the server that the response was invalid?

If the reverse was true (i.e. server request is good, client request is bad), should the same approach be taken?

Should the request identifier be included?

--> {"jsonrpc": "2.0", "method": "subtract", "params": {"subtrahend": 23, "minuend": 42}, "id": 3}
<-- {"jsonrpc": "2.0", "id": 3} /* Note that results property is missing */

--> {"jsonrpc": "2.0", "error": {"code": -123, "message": "Results property is missing"}}
user1032531
  • 24,767
  • 68
  • 217
  • 387

1 Answers1

1

The JSON-RPC protocol doesn't specify responses from the client. In the same way, the server doesn't send requests.

Client sends Request objects and server returns Response objects.

You may create a method in server to receive such notifications, but it is at the application level, not related to the JSON-RPC protocol.

--> {"jsonrpc": "2.0", "method": "reportError", "params": {"method": "subtract", "error": "Results property is missing" } }
Rodris
  • 2,603
  • 1
  • 17
  • 25