The StreamJsonRpc library offers JSON-RPC 2.0 over any .NET Stream, WebSocket, or Pipe. With bonus support for request cancellation, client proxy generation, and more.
My case: launcher application that is able to spawn 2 child apps. I want my launcher and child apps be able to talk to each other via json rpc, meaning sending multiple messages back and forth when needed. Based on od cond sampes I implemented it this way:
Launcher creates a server based on InOut NamedPipeServerStream with name "Parent"
Launcher starts child app
child app creates InOut server with generated name
child creates NamedPipeClientStream to "Parent"
child calls remote procedure on parent "ChildReady" with generated name as paramter
Parent creates NPCS with child's name
parent and child send messages to each other via respecitve Client streams
server streams get recreated after each precessed message (via while (true) loops)
while (true)
{
var stream = new NamedPipeServerStream("StreamJsonRpcSamplePipe", PipeDirection.InOut, NamedPipeServerStream.MaxAllowedServerInstances, PipeTransmissionMode.Byte, PipeOptions.Asynchronous);
await stream.WaitForConnectionAsync();
var jsonRpc = JsonRpc.Attach(stream, this);
await jsonRpc.Completion;
}
Hi,
My case: launcher application that is able to spawn 2 child apps. I want my launcher and child apps be able to talk to each other via json rpc, meaning sending multiple messages back and forth when needed. Based on od cond sampes I implemented it this way:
server streams get recreated after each precessed message (via while (true) loops)
is that the way to go for this case?