beaglebone/main.js
// create main server and websocket server
create main server and websocket server
create main server and websocket server
function runServer (socket, uart) {
  log.info("Starting Server");
  var app = express();
  app.use(express.static(__dirname + '/public'));
  var server = http.createServer(app);
  server.listen(80);
  var car_state = new CarState();
  pure_uart_handler(uart, car_state);
  pure_socket_handler(socket, car_state);
  uart_socket_handler(uart, socket, car_state);
  var wss = new WebSocketServer({server: server});
  wss.on('connection', function (ws) {
    log.info("Running websockets");
    pure_ws_handler(ws, car_state);
    ws_socket_handler(ws, socket);
    ws_uart_handler(ws, uart, car_state);
  });
}
function runServer ( socket , uart ) { log . info ( "Starting Server" ) ; var app = express ( ) ; app . use ( express . static ( __dirname + '/public' ) ) ; var server = http . createServer ( app ) ; server . listen ( 80 ) ; var car_state = new CarState ( ) ; pure_uart_handler ( uart , car_state ) ; pure_socket_handler ( socket , car_state ) ; uart_socket_handler ( uart , socket , car_state ) ; var wss = new WebSocketServer ( { server : server } ) ; wss . on ( 'connection' , function ( ws ) { log . info ( "Running websockets" ) ; pure_ws_handler ( ws , car_state ) ; ws_socket_handler ( ws , socket ) ; ws_uart_handler ( ws , uart , car_state ) ; } ) ; }
create main server and websocket server
create main server and websocket server