JSON-RPC

 view release on metacpan or  search on metacpan

README.md  view on Meta::CPAN

Notification handling does not produce a response. When all procedures are notifications no content is returned (if the request is valid).
To maintain some basic compatibility with relaxed client implementations, JSON::RPC::Dispatch includes responses when procedures do not have a "jsonrpc" field set to "2.0".

Note that no error is returned in response to a notification when the handler dies or when the requested method is not available.

For example, a request structure like this:

    [
        {"jsonrpc": "2.0", "method": "sum", "params": [1,2,4], "id": "1"},
        {"jsonrpc": "2.0", "method": "notify_hello", "params": [7]},
        {"jsonrpc": "2.0", "method": "keep_alive"},
        {"jsonrpc": "2.0", "method": "get_data", "id": "9"}
    ]

Would result in a response like

    [
        {"jsonrpc": "2.0", "result": 7, "id": "1"},
        {"jsonrpc": "2.0", "result": ["hello", 5], "id": "9"}
    ]

lib/JSON/RPC.pm  view on Meta::CPAN

Notification handling does not produce a response. When all procedures are notifications no content is returned (if the request is valid).
To maintain some basic compatibility with relaxed client implementations, JSON::RPC::Dispatch includes responses when procedures do not have a "jsonrpc" field set to "2.0".

Note that no error is returned in response to a notification when the handler dies or when the requested method is not available.

For example, a request structure like this:

    [
        {"jsonrpc": "2.0", "method": "sum", "params": [1,2,4], "id": "1"},
        {"jsonrpc": "2.0", "method": "notify_hello", "params": [7]},
        {"jsonrpc": "2.0", "method": "keep_alive"},
        {"jsonrpc": "2.0", "method": "get_data", "id": "9"}
    ]

Would result in a response like

    [
        {"jsonrpc": "2.0", "result": 7, "id": "1"},
        {"jsonrpc": "2.0", "result": ["hello", 5], "id": "9"}
    ]



( run in 0.516 second using v1.01-cache-2.11-cpan-483215c6ad5 )