✅ How to make httpcontext threadsafe?
I have this:
I save these connections to ConcurrentDictionary, and when I need to send a message, I just find the connection from the dictionary and use SendEventAsync.
I don't know why, but sometimes I don't see that any events have been sent, and it looks like a race condition. What can I do about it?
5 Replies
Any reason why you want to do that rather than using the
HttpClientFactory
?are you using this for sse/websocket?
yes, sse
have you already discarded using signalr?
it is impossible to use signalr here