code: function sendEvent(event) {
    var message = JSON.stringify(event);
  
    console.log('ws -> send: ' + message);
  
    var clients = serverMode ? wss.clients : [ws];
  
    for (var i = 0; i < clients.length; i++) {
      clients[i].send(message);
    }
  }
docs: TODO: open/close ws on state change