chowey / jsonrpc

Standards-compliant JSON-RPC for go

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Spec not followed for notifications

chowey opened this issue · comments

Per the JSON-RPC 2.0 Specification:

id
An identifier established by the Client that MUST contain a String, Number, or NULL value if included. If it is not included it is assumed to be a notification. The value SHOULD normally not be Null and Numbers SHOULD NOT contain fractional parts

And then later:

4.1 Notification

A Notification is a Request object without an "id" member. A Request object that is a Notification signifies the Client's lack of interest in the corresponding Response object, and as such no Response object needs to be returned to the client. The Server MUST NOT reply to a Notification, including those that are within a batch request.

Clearly when there is no ID specified, then the JSON-RPC server should not reply with anything.

I think clearest is to return a status code 204 for HTTP:

The HTTP 204 No Content success status response code indicates that the request has succeeded, but that the client doesn't need to go away from its current page.

This should now be fixed with bfe9be7.