Copyright © https://mongoose-os.com

Mongoose OS Forum

frame

JSON-RPC 2.0 compliancy

Hello

First, thanks for the awesome OS!

The documentation says that "Mongoose OS uses JSON-RPC 2.0". After playing with it I see it is not JSON-RPC 2.0 compliant. For example there is no "jsonrpc": "2.0" in the response, it doesn't respond with error code -32700 if I send malformed JSON, it uses nonstandard "src" and other fields, etc. Was there a reason to implement it like that? If yes, then maybe documentation should not state that it is JSON-RPC 2.0.

Thanks in advance,

Regards

Comments

  • rojerrojer Dublin, Ireland

    well, you are correct about "jsonrpc": "2.0", so it's not strictly jsonrpc

  • SergeySergey Dublin, Ireland

    @UserMartin you're correct and we're aware about it.

    We'll make a documentation change to point to the differences with JSON-RPC 2.0

    Reasons:
    Sending "jsonrpc": "2.0" in every frame is not wise in embedded context, we'll make it optional.
    The src key is for routing, specifically for MQTT where you cannot send response to the same topic request came.
    Replying with -32700 on bad JSON should be done,.

    All in all, the idea is: if you tell a device "hey, include jsonrpc:2.0 thing in every frame", the communication will be JSON-RPC-2.0 compliant with exception of MQTT.

Sign In or Register to comment.