   # write socket.io color data to buffer as UART instruction
   #
   _to_buffer: (data) ->
-    # logger.info "writing to buffer #{data.color}"
-    buffer = @_data_to_instruction(data)
+    @buffer = @_data_to_instruction(data)
 
 module.exports = Server

io     = require 'socket.io-client'
logger = require './logger'
FS     = require 'fs'
buffer = ''
ws     = undefined

class Server
  constructor: (@host, @port, @options = {}) ->

  #

  # create writestream to kernel at /dev/ttyO1
  #
  _setup_writestream: ->
    @ws = FS.createWriteStream "/dev/ttyO1",
      flags: "w+"

  #
  # if buffer has content, write buffer directly to the kernel via /dev/ttyO1 pipe
  # at 15ms resolution. recursively call this function using setInterval()
  #
  _write_pipe: ->
    setInterval (=>
      return if @buffer.length == 0
      @ws.write(@buffer, (err, written) =>
        throw err if err
        @buffer = ''
      )
    ), 15

  #
