Node.js module to run a BreakoutJS server
#Using the Node server
A node.js-based server is provided as an alternative to the Breakout Server GUI application.
Navigate to Breakout/node_server/ and type:
npm install to install the dependencies.
Windows users, refer to the readme for node-serialport before installing. I have not had any luck getting node-serialport to work in Windows 7 (but that does not mean all hope is lost).
You can alternatively install the breakout-server npm package:
npm install breakout-server from outside of the Breakout directory (for example to create a new Breakout project). This will install server.js and its dependencies.
node server.js --helpto view the command line options.
ls /dev/tty.*in the terminal in OS X,
ls /dev/ttyACM*in the terminal in Linux, or get it from the Arduino IDE under Tools -> Serial Port) you can add the command line argument:
-p /dev/tty.usbmodemfd131(or whatever your unique serial port is). To permanently change the default port, modify line 26 in the server.js file.
node server.js(plus any optional command line arguments) to start the server. If you are trying to run an example from the Breakout root directory then use
node node_server/server.jsor if you are in the node_server directory, run
node server.js -d ../to set the path to the Breakout root directory.
"info - socket.io started Server is runnint at: http://localhost:8887 -> CTRL + C to shutdown"in your terminal.
When creating your index.html file, include
<script src="../../socket.io/socket.io.js"></script> before the Breakout.min.js script (the path should be relative to the root web directory, which is either the location of server.js or an alternate location that you specify with the -d command line option when running server.js). The socket.io.js file is included automatically by the server so you do not need to include it separately in your project. Make sure the network port in the IOBoard constructor is 8887 or any other value you set in the server.js file.