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

Michael Van Canneyt michael at freepascal.org
Mon Oct 3 17:48:26 CEST 2022



On Sun, 2 Oct 2022, Wayne Sherman wrote:

> Wayne wrote:
>> JSON-RPC can be used bi-directionally when using
>> UNIX domain sockets, TCP sockets, and other
>> bidirectional transports (e.g websockets).
>> If implemented as such using a bi-direction transport,
>> the endpoints can be both a server and a client
>> at the same time...
>
> Sorry, my use of the term "bi-directional" is not really correct.
> JSON-RPC is generally a bi-directional protocol (except when sending a
> "notification").  The issue is that some bi-directional transports
> (e.g. HTTP) close the connection after a response.  So for these types
> of transports, a "server" cannot become a "client" since the
> connection has been closed.
>
> But if JSON-RPC is implemented using a transport which maintains (or
> keeps open) a bi-directional connection, then either endpoint can
> issue requests during the session if so desired. (i.e. either side can
> be a server or a client at any point during the session).

FPC's JSON-RPC is designed to be used using HTTP(s) transport only, i.e.
synchronous request and answer.

Hence Ryan's failure to achieve what he wants to do.

But if changes need to be made to make it usable over other transports, 
then I am open for suggestions. With the new support for websockets in FPC, 
this seems like a good time to review the architecture.

Michael.


More information about the fpc-pascal mailing list