code: function server(options) {
    status = 'server.started'
    config = _.extend(defaultServerOptions, options)
  
    open(config.datafile)
  
    if (config.logToConsole)
      console.log("✔ log to stdout")
  
    // ws [
    var ServerMessageLog = {}
    var queueMessages = []
    var timer
  
    function flushMessages(n) {
      queueMessages = _.sortBy(queueMessages, 'time')
      var messages = queueMessages.slice(0, n)
      queueMessages = queueMessages.slice(n)
  //    console.log(messages);
      _.each(messages, function (m) {
  //      var filename = options.logpath+'/1.log'
  //      logString(filename, m.text)
        logMessage(new Date(m.time), m.path, m.data, m.type == 'log' ? '' : m.type)
      })
    }
  
    console.log("✔ ws server listening on port %d", config.port)
  
    var wss = new WebSocketServer({port: config.port});
  
    wss.on('connection', function(ws) {
      ws.on('message', function(m) {
        var message = JSON.parse(m)
        queueMessages.push(message)
        if (queueMessages.length > config.queueMessagesMax)
          flushMessages(config.flushMessagesCount)
  
        if (timer)
          clearTimeout(timer)
        timer = setTimeout(function () {
          timer = null
          flushMessages(queueMessages.length)
        }, config.serverFlushTimeout)
      })
    })
    // ws ]
  }
docs: flush ] DataFile ] server [