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 transmission support #130

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open

Conversation

narikei
Copy link

@narikei narikei commented Dec 14, 2024

No description provided.

narikei and others added 4 commits December 14, 2024 12:46
This exposes a new `setBroadcast` feature on the client with
an optional callback. Tests + docs included.
@MylesBorins
Copy link
Owner

@narikei thanks for the PR. I've pushed some changes to the PR, specifically exposing setBroadcast as a function with optional callback which will allow changes the state of setBroadcast and not change the current behavior of lazily binding on first message sent. I'm not 100% that there aren't edge cases I've created, but I think I covered them.

One thing I couldn't quite test properly is that setting this flag has the desired result for your use case. Could you check out this branch and test it out manually to let me know.

cb();
return;
}
this._sock.bind(this.port, () => {
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@MylesBorins Thank you so much!
I can mostly achieve what I want to do.
In my environment, only this part didn’t work properly. It works if I remove the port specification.

this._sock.bind(() => {

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you remove the specified port in the call to bind then node will just pick a random port, that really isn't desirable functionality. Are you getting an error?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I understand this specification. No problem!

Because I was testing sending and receiving on the same PC, the port number was duplicated and the callback was not called.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@narikei do you have an example script of what you are trying to do that I can play with? I'm not running into the same problem regarding duplicated port number and binding between server + client in my tests.

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

Successfully merging this pull request may close these issues.

2 participants