Skip to content

Making library thread-safety #596

@ventaquil

Description

@ventaquil

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions