I have a SignalR client application, written in C#, that subscribe an event from the Hub. When the Event is "fired" the application executes a method.
The question is that all events of that kind, to that client, are processed in sequentially.
Use Case / Flow:
- In a Browser, an user clicks a button
- The button triggers a call to a SignalR Hub
- The SignalR Hub send the message to a specific SignalR client
- The SignalR Client receives the event/message
- The SignalR Client invoke a method that will store the message in a Database
- The SignalR Client invoke a method in the Hub to return the result
- The Hub deliver to the user the result
If another user clicks the button at the same time, the SignalR Client will only store one message at a time.
Client Example:
myHub.On<ExecuteRequestModel, string>("Execute", (request, to) =>
{
logger.Info("Execute request received for connectionID: " + connection.ConnectionId);
myMethod();
myHub.Invoke("ExecuteResult", response, to);
logger.Info("Execute request processed");
logger.Info("...");
});
There's any recommended practice to handle multiple events in a concurrent way?