View Source grisp_connect_api (grisp_connect v1.1.0)

Library module containing the jsonrpc API logic

Summary

Functions

Indentifies if the message is a request or a reply to a previous request. In case it was a request, returns the reply to be sent to the peer. In case it was a response, returns the parsed ID and content to be handled by the caller.

Functions

-spec handle_msg(JSON :: binary()) ->
                    {send_response, Response :: binary()} |
                    {handle_response, ID :: binary(), {ok, Result :: map()} | {error, atom()}}.

Indentifies if the message is a request or a reply to a previous request. In case it was a request, returns the reply to be sent to the peer. In case it was a response, returns the parsed ID and content to be handled by the caller.

Link to this function

notify(Method, Type, Params)

View Source
-spec notify(Method :: atom() | binary(), Type :: atom() | binary(), Params :: map()) ->
                Encoded :: binary().
Link to this function

request(Method, Type, Params)

View Source
-spec request(Method :: atom() | binary(), Type :: atom() | binary(), Params :: map()) ->
                 {ID :: binary(), Encoded :: binary()}.