最初在Emacs-general中发送。
话说jsonrpc有没有什么使用例?
看官方的那个文档没有看懂
(defclass jsonrpc-connection ()
((name
:accessor jsonrpc-name
:initarg :name
:documentation "A name for the connection")
(-request-dispatcher
:accessor jsonrpc--request-dispatcher
:initform #'ignore
:initarg :request-dispatcher
:documentation "Dispatcher for remotely invoked requests.")
(-notification-dispatcher
:accessor jsonrpc--notification-dispatcher
:initform #'ignore
:initarg :notification-dispatcher
:documentation "Dispatcher for remotely invoked notifications.")
(last-error
:accessor jsonrpc-last-error
:documentation "Last JSONRPC error message received from endpoint.")
(-request-continuations
:initform (make-hash-table)
:accessor jsonrpc--request-continuations
:documentation "A hash table of request ID to continuation lambdas.")
(-events-buffer
:accessor jsonrpc--events-buffer
:documentation "A buffer pretty-printing the JSONRPC events")
(-events-buffer-scrollback-size
:initarg :events-buffer-scrollback-size
:accessor jsonrpc--events-buffer-scrollback-size
:documentation "Max size of events buffer. 0 disables, nil means infinite.")
(-deferred-actions
:initform (make-hash-table :test #'equal)
:accessor jsonrpc--deferred-actions
:documentation "Map (DEFERRED BUF) to (FN TIMER ID). FN is\
a saved DEFERRED `async-request' from BUF, to be sent not later\
than TIMER as ID.")
(-next-request-id
:initform 0
:accessor jsonrpc--next-request-id
:documentation "Next number used for a request"))
:documentation "Base class representing a JSONRPC connection.
The following initargs are accepted:
:NAME (mandatory), a string naming the connection
:REQUEST-DISPATCHER (optional), a function of three
arguments (CONN METHOD PARAMS) for handling JSONRPC requests.
CONN is a `jsonrpc-connection' object, method is a symbol, and
PARAMS is a plist representing a JSON object. The function is
expected to return a JSONRPC result, a plist of (:result
RESULT) or signal an error of type `jsonrpc-error'.
:NOTIFICATION-DISPATCHER (optional), a function of three
arguments (CONN METHOD PARAMS) for handling JSONRPC
notifications. CONN, METHOD and PARAMS are the same as in
:REQUEST-DISPATCHER.")
比如这个jsonrpc-connection的类,我如果想让他连接 localhost:8970,应该怎么实例化这个类呢?
(jsonrpc-connection-send CONN &key ID METHOD PARAMS RESULT ERROR)
Documentation
Send a JSONRPC message to connection CONN.
ID, METHOD, PARAMS, RESULT and ERROR.
```
也不是在send的时候传入服务端位置