0

I still wasn't 100% sure after reading the JSON-RPC 2.0 spec about this: Does the spec allow the sender of a Notification the ability to receive back an Error object? For example if the receiver of the Notification failed to parse the payload of the Notification, can it reply back saying that it failed to parse? Or even that is not allowed?

If it allowed, then does the Error object response require the presence of the "id": null or not?

Thanks.

Henry

1 Answer 1

3

Yes, you should respond with an error if it's not a valid JSON-RPC request.

If there is not enough progression through the process to determine that the request object is a notification, it should default to normal request handling, which would include sending a response... which probably is also always an error.

Source

As for the second part of your question, yes, you must include "id": null.

id

This member is REQUIRED. If there was an error in detecting the id in the Request object (e.g. Parse error/Invalid Request), it MUST be Null.

Source

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.