Skip to content

Sharing client and server on same transport #487

Open
@ebkalderon

Description

@ebkalderon

Does the current design of jsonrpc-core-client allow for a server and client (different schemas) to share the same duplex transport? The use case for this would be a language server, which has a handful of special methods and notifications that are sent from the server to the client, rather than the other way around (see ebkalderon/tower-lsp#13 for further detail). They both also communicate over stdio, which is challenging since one has to be careful to not accidentally feed the responses from the client read on stdin back into the server as though it were a request.

In tower-lsp, I am currently working around this limitation by manually interleaving the responses produced by the server together with extra notifications intended for the client to read all to stdout. This works perfectly for notifications, but I cannot easily support sending requests to the client and picking up the responses, all while sharing the same stdout and stdin used by the server.

As such, it would be nice if there was some way to have the client-to-server schema defined in one jsonrpc-derive::rpc trait, the server-to-client schema defined in another jsonrpc-derive::rpc trait, and to instantiate both using the same stdin and stdout handles.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions