-
Notifications
You must be signed in to change notification settings - Fork 73
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
base: main
Are you sure you want to change the base?
Conversation
This exposes a new `setBroadcast` feature on the client with an optional callback. Tests + docs included.
@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, () => { |
There was a problem hiding this comment.
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(() => {
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
No description provided.