public void RespondAsync <TRequest, TResult>(Func <TRequest, Task <TResult> > callback, CancellationToken cancellationToken = default) where TRequest : class, new() where TResult : class, new() { var xtResult = _rqRep.RespondAsync <TRequest, TResult>(callback, cancellationToken); ThrowOnNonSuccess(xtResult); }
internal static async Task AsyncServer(SocketConfiguration configuration) { using var socket = new RqRep(configuration); socket.RespondAsync <Request, Response>(async r => { await Task.Delay(100); return(new Response { InsideResponse = "waited asynchronously for 100ms" }); } ); await RequestAndWriteResultAsync(socket); }