Skip to content

Commit

Permalink
Broadcast transmission support
Browse files Browse the repository at this point in the history
  • Loading branch information
narikei committed Dec 14, 2024
1 parent 5e6d356 commit be7016c
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion lib/Client.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,19 @@ import Message from './Message.mjs';
const { toBuffer } = oscMin;

class Client {
constructor(host, port) {
constructor(host, port, isBroadcast = false) {
this.host = host;
this.port = port;
this._sock = createSocket({
type: 'udp4',
reuseAddr: true
});

if (isBroadcast) {
this._sock.bind(() => {
this._sock.setBroadcast(true);
});
}
}
close(cb) {
this._sock.close(cb);
Expand Down

0 comments on commit be7016c

Please sign in to comment.