blob: f8d88d40b1b27c9549b443182be160e5cb1f37cf (
plain)
1
2
3
4
5
6
7
|
<h4 class="subsection">Process-based JSONRPC connections</h4> <p>For convenience, the <code>jsonrpc</code> library comes with a built-in <code>jsonrpc-process-connection</code> transport implementation that can talk to local subprocesses (using the standard input and standard output); or TCP hosts (using sockets); or any other remote endpoint that Emacs’s process object can represent (see <a href="processes">Processes</a>). </p> <p>Using this transport, the JSONRPC messages are encoded on the wire as plain text and prefaced by some basic HTTP-style enveloping headers, such as “Content-Length”. </p> <p>For an example of an application using this transport scheme on top of JSONRPC, see the <a href="https://microsoft.github.io/language-server-protocol/specification">Language Server Protocol</a>. </p> <p>Along with the mandatory <code>:request-dispatcher</code> and <code>:notification-dispatcher</code> initargs, users of the <code>jsonrpc-process-connection</code> class should pass the following initargs as keyword-value pairs to <code>make-instance</code>: </p> <dl compact> <dt><code>:process</code></dt> <dd>
<p>Value must be a live process object or a function of no arguments producing one such object. If passed a process object, the object is expected to contain a pre-established connection; otherwise, the function is called immediately after the object is made. </p> </dd> <dt><code>:on-shutdown</code></dt> <dd><p>Value must be a function of a single argument, the <code>jsonrpc-process-connection</code> object. The function is called after the underlying process object has been deleted (either deliberately by <code>jsonrpc-shutdown</code>, or unexpectedly, because of some external cause). </p></dd> </dl><div class="_attribution">
<p class="_attribution-p">
Copyright © 1990-1996, 1998-2022 Free Software Foundation, Inc. <br>Licensed under the GNU GPL license.<br>
<a href="https://www.gnu.org/software/emacs/manual/html_node/elisp/Process_002dbased-JSONRPC-connections.html" class="_attribution-link">https://www.gnu.org/software/emacs/manual/html_node/elisp/Process_002dbased-JSONRPC-connections.html</a>
</p>
</div>
|