Function: jsonrpc-convert-to-endpoint

jsonrpc-convert-to-endpoint is a byte-compiled function defined in jsonrpc.el.gz.

Signature

(jsonrpc-convert-to-endpoint CONNECTION MESSAGE SUBTYPE)

Documentation

Convert MESSAGE to JSONRPCesque message accepted by endpoint.

MESSAGE is a plist, jsonrpc.el's internal representation of a JSONRPC message. SUBTYPE is one of request, reply or notification.

Return a plist to be serialized to JSON with json-serialize and transmitted to endpoint.

View in manual

Implementations

(jsonrpc-convert-to-endpoint S MESSAGE SUBTYPE) in `jsonrpc.el'.

Undocumented

Source Code

;; Defined in /usr/src/emacs/lisp/jsonrpc.el.gz
;;; API optional
(cl-defgeneric jsonrpc-convert-to-endpoint (connection message subtype)
  "Convert MESSAGE to JSONRPCesque message accepted by endpoint.
MESSAGE is a plist, jsonrpc.el's internal representation of a
JSONRPC message.  SUBTYPE is one of `request', `reply' or
`notification'.

Return a plist to be serialized to JSON with `json-serialize' and
transmitted to endpoint."
  ;; TODO: describe representations and serialization in manual and
  ;; link here.
  (:method (_s message subtype)
           `(:jsonrpc "2.0"
                      ,@(if (eq subtype 'reply)
                            ;; true JSONRPC doesn't have `method'
                            ;; fields in responses.
                            (cl-loop for (k v) on message by #'cddr
                                     unless (eq k :method)
                                     collect k and collect v)
                          message))))