socket.io-serial
A virtual node-serialport implementation that uses socket.io as the transport.
Installation
npm install socket.io-serial
SocketSerialPort
Use socket.io to send/receive data to a remote physical device:
var SocketSerialPort = SerialPort;var io = ;var firmata = ; // setup the socket.io clientvar client = ; //create the socket.io serialport and specify the send and receive topicsvar serialPort = client: client transmitTopic: 'REPLACE WITH YOUR TRANSMIT TOPIC' receiveTopic: 'REPLACE WITH YOUR RECEIVE TOPIC'; //use the virtual serial port to send a command to a firmata devicevar board = serialPort { if err throw err; //light up a pin board;};
bindPhysical
Bind a physical serial port to receive/send data from a socket.io server:
var SerialPort = SerialPort;var bindPhysical = bindPhysical;var skynet = ; // setup the socket.io clientvar client = ; // setup a connection to a physical serial portvar serialPort = '/dev/tty.usbmodem1411' baudrate: 57600 buffersize: 1; //connects the physical device to a socket.io server;