PORT = 33333
HOST = process.env.SERVER || 'lights.socoded.com'

dgram = require('dgram')

module.exports = function(i,r,g,b) {
  client = dgram.createSocket('udp4');
  message = new Buffer([i,r,g,b].join(','));
  client.send(message, 0, message.length, PORT, HOST, function(err, bytes) {
    if (err) {
      throw err
    }
  });
  client.close();
}

@@ -204,16 +204,104 @@
 (','));%0A
+  if (process.env.DEBUG) %7B%0A    console.log(message, 0, message.length, PORT, HOST);%0A  %7D%0A
   client
@@ -365,24 +365,98 @@
 r, bytes) %7B%0A
+    if (process.env.DEBUG) %7B%0A      console.log('sent', err, bytes);%0A    %7D%0A
     if (err)
@@ -486,12 +486,8 @@
 %7D%0A  
-%7D);%0A
   cl
@@ -500,10 +500,16 @@
 lose();%0A
+  %7D);%0A
 %7D%0A

add debug and fix client close