-
-
Notifications
You must be signed in to change notification settings - Fork 625
Closed
Labels
Description
I want to ask why library is not thread-safe by default?
For example in Server.emit method docblock we can read Note: this method is not thread safe..
It's going to be more useful when library does such things under the hood.
The simplest solution is to create Lock immediately after client connects to the server - and removes lock after client disconnects. Emit method uses that lock if it's emmiting data to specified client.
There should be something like lock-aggregator to handle broadcast and room emits too (such aggregator waits for all child-locks).
I can prepare PR but maybe there is a reason why you don't implement this feature. I am open for discussion.