I would like to be able to do something like this:
IHubProxy myHubProxy = /* ... */;
var t1 = Task.Run(() => myHubProxy.Invoke<int>("Foo");
var t2 = Task.Run(() => myHubProxy.Invoke<int>("Foo");
var r1 = await t1;
var r2 = await t2;
Where "Foo" is executed in parallel on the server. However, the way things work by default I believe both of the calls will be synchronized to the hub's thread context and run one by one. Is there any simple way to have a single hubProxy schedule two parallel invocations on the same SignalR hubproxy/connection?
You can't send messages in parallel because a transport like webSockets uses the same connection the whole time, you would be trying to interleave messages and it can't be handled. If you need multiple transfers in parallel, then use multiple connections
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With