node-dmx / dmx

DMX controller library for node.js
MIT License
297 stars 95 forks source link

Broadcast on artnet #40

Closed Joebayld closed 6 years ago

Joebayld commented 6 years ago

I need to enable broadcast on the artnet driver. I added this code to make it work.

self.dev.on('listening', function(){
    self.dev.setBroadcast(true);
});

Should we add it to the master? Or maybe have an option to enable broadcast?

wiedi commented 6 years ago

The setBroadcast() call seems reasonable. Is the event handler for 'listening' actually required or could we just do setBroadcast directly below the self.dev = dgram.createSocket('udp4') line?

Joebayld commented 6 years ago

I tried adding it below and it didn’t work. Upon research, I found this solution and it works.

Joe

On Jan 11, 2018, at 1:37 PM, Sebastian Wiedenroth notifications@github.com wrote:

The setBroadcast() call seems reasonable. Is the event handler for 'listening' actually required or could we just do setBroadcast directly below the self.dev = dgram.createSocket('udp4') line?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

wiedi commented 6 years ago

ok great, thanks for confirming that. Do you want to create a pull request?

Joebayld commented 6 years ago

I found a more elegant way to solve this by including the broadcast enable in a bind closure. Tested and working.

41

wiedi commented 6 years ago

merged, thanks!