Open green-coder opened 8 years ago
I'll investigate to what extent this is an issue. Unity is single threaded and this is their code borrowed from their websocket wrapper around web-socket-sharp. Broadly speaking, it should be possible to just use lock
around accesses to the queue but I don't know if that's necessary...
I do think that there are multiple threads, but I don't know if your use of the Queue class will be problematic or not.
FYR, I implemented a DDP-client for Unity3D recently, and I used this class for the queue. Maybe that class can help you.
I know this is a stale issue, but I believe today, there is an issue with using the regular queue class with the current websocketsharp lib. I have been using the exact ConcurrentQueue implementation from 4.0.0.0 mscorlib (Microsoft's code) and I'll port it into the package here soon.
This queue is used by multiple threads but I am afraid that the
Queue
class it is not thread safe.