socket.io-client-csharp
socket.io-client-csharp copied to clipboard
Is getting messages in order possible?
Is there any way to get messages from a web socket in order in c#? Based on my understanding and testing, since web socket transport uses ConfigureAwait(continueOnCapturedContext: false) handlers are dispatched on arbitrary threads with no way to ensure that they are executed in the same order as the messages read from the web socket.
This is a problem when processing ordered streams of messages as needed to work with the newer voice enabled LLM apis, for example. In my case, events are streamed from the browser to a C# service, and forwarded to the LLM's API. But the event handlers are called out of order on occasion, causing garbled voice input and output streams.