Skip to content

haakonnessjoen/artnet-node

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

52 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

artnet-node

Art-Net Library for NodeJS

Client example

Here is an example that sends 4 dmx channels 10 times to each node it finds on the network, and then exits.

  var artnet = require('arnet-node');
  var artnetClient = artnet.Client;
  
  artnet.Discover(function (err, data) {
    if (data) {
      console.log("I found: ", data);
      for (var i = 0; i < data.length; ++i) {

        // Send 1 packet to each node found, at universe 1
        var client = new artnetClient(data[i].address, data[i].port, 1);
        client.count = 0;

        for (var ii = 0; ii < 10; ++ii) {

          client.send([255, 255, 255, 255], function (err) {
            if (!err) {
              console.log("Packet sent to " + this._host);
            } else {
              console.log("Error: ", err);
            }

            // Close socket when done
            if (--this.count == 0) this.close();
          });

          client.count++;
        }

      }
    }
  }, 3000, "10.255.255.255");

Written by (amongst others)

  • Brian McClain
  • Martin Herbst
  • Håkon Nessjøen

About

Art-Net server and client module for Node.JS

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%