[fpc-pascal] JSON RPC send server request to client

Wayne Sherman wsherman at gmail.com
Tue Oct 4 18:07:37 CEST 2022


Michael wrote:
> Seems like both parts in the LSP protocol are playing 'client' and 'server', because:
>
> "The Client is defined as the origin of Request objects and the handler of Response objects.
>   The Server is defined as the origin of Response objects and the handler of Request objects."
>
> As usual one can trust Microsoft to give an own interpretation to a protocol :)

The JSON-RPC protocol defines client and server strictly by who sends
the request and who handles the response.  An endpoint can be both a
client and server at the same time over the same connection if the
transport permits.  For example, Endpoint-1 connects to Endpoint-2
using a standard TCP socket or UNIX socket.  Endpoint-1 is a
"JSON-RPC" client when it sends a request, and Endpoint-2 is a
"JSON-RPC" server when it receives the request and sends a response.
But when Endpoint-2 initiates a request to Endpoint-1 over the same
connection, Endpoint-2 is a "JSON-RPC" client and Endpoint-1 is a
"JSON-RPC" server (i.e. the roles have switched, which is not
prohibited by the protocol).  After the definition of client/server
the spec says:

"One implementation of this specification could easily fill both of
those roles, *even at the same time*, to other different clients or the
same client"


More information about the fpc-pascal mailing list