Search code examples
c#multithreadingasynchronoussignalrsignalr-hub

C#: How do I wait 10 seconds for a client to call a method?


On a server(Web API), I have methods A and B. When method A reaches a certain point it uses SignalR to call a client method with a certain ID and then has to wait 10 seconds. If a client calls web method B with that ID within those 10 seconds then method A enters Path 1. If a client does not call method B then method A enters Path 2. Do you have any ideas on how to implement that? Thank you, Peter Chikov


Solution

  • HTTP is designed to be stateless. If possible, the server should not be attempting to keep track of the client's state. Can you change your implementation so that the client initiates a new request after the SignalR call and then enters path #1 or #2?