Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Broadcast functions do not exclude current client #9

Closed
SnoutUp opened this issue Jan 22, 2022 · 2 comments
Closed

Broadcast functions do not exclude current client #9

SnoutUp opened this issue Jan 22, 2022 · 2 comments

Comments

@SnoutUp
Copy link

SnoutUp commented Jan 22, 2022

First of all, thank you for creating this framework! Buffers are just not friends of mine...

However it looks like "notme" flag in broadcastList function doesn't work as intended as "this" is always undefined in the context of the comparison function.

Easy fix:

    broadcastList(clients, pack, notme = true) {
        let me = this;
        clients.forEach(function (client) {
            if (client === me && notme) {
                // skip me
            } else {
                client.write(pack);
            }
        });
    }

Cheers!

@evolutionleo
Copy link
Owner

evolutionleo commented Jan 22, 2022

Hmm, this is really weird because I totally remember fixing this before, using a solution that is very similar to this one
I might have forgotten to change it for the TypeScript server and so it got reintroduced idk
Thank you for noticing!

@evolutionleo
Copy link
Owner

Pushed an update to fix this bug that got reintroduced. Thanks again for noticing!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants