icerpc / icerpc-csharp

A C# RPC framework built for QUIC, with bidirectional streaming, first-class async/await, and Protobuf support.
https://docs.icerpc.dev
Apache License 2.0
107 stars 13 forks source link

Server -> Client Invocations #3935

Closed IAmUser4574 closed 7 months ago

IAmUser4574 commented 7 months ago

With the existing API documentation and examples I was able to write a few successful test applications of Client -> Server invocations and responses. However, I'd like to support Server-originated messages to Clients and Server forwarding of messages from one client to another. I've poured through the docs and, while I've found references to a ConnectionCache (which I imagine I can implement on the Server), I've yet to get something like that working with client callbacks as the documentation is sparse on usage, both on the setup of the server and the client.

I was wondering if anyone familiar with this project has already tread down this path and figured out a working configuration with client callbacks.

pepone commented 7 months ago

You should read https://zeroc.com/blog/other-way-around and check the companion example https://github.com/icerpc/icerpc-csharp/tree/main/examples/slice/Thermostat, I think that is what you are looking for!

Let us know if something is not clear.

bernardnormier commented 7 months ago

ConnectionCache is a class provided by IceRPC - you don't implement it. And it's a client-side class: it's a cache of outbound connections.

See https://docs.icerpc.dev/icerpc/connection/how-to-create-a-connection#creating-a-client-connection and https://docs.icerpc.dev/api/csharp/api/IceRpc.ConnectionCache.html