         @_write_file()
         return
       else
+        console.log "writing to file"
+        console.log buffer
         ws.write(buffer, (err, written) =>
           throw err if err
-          # ws.end()
+          buffer = ''
           @_write_file()
         )
-    ), 25
+    ), 15
 
   #
   # convert halo rgba string to a UART instruction

  # 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)

  #
  # empty the buffer
  #
  _clear_buffer: ->
    logger.info "clearing buffer"
    buffer = ''

module.exports = Server

  # connect socket.io client to url, bind to socket.io events and our custom events
  #
  _setup_sio: ->
    # logger.debug "Socket.io connecting to url #{@_url()}"
    socket = new io(@_url(), {})
    socket.on 'connect', =>
      console.log "connected to socket at #{@_url()}"
