soundanalogous / Breakout

Breakout is a javascript library and toolkit for connecting Arduino and other IOBoards to the web
www.breakoutjs.com
MIT License
180 stars 20 forks source link

Multiple simultaneous connections + Service #52

Open ghost opened 11 years ago

ghost commented 11 years ago

Hello,

First of all the auto connect option is a very good step to make the server more usable for production and i think it will be better if:

1- the server can tun as a service so no GUI unless we need to change the config. 2- we can use more than one serial<->TCP bridge so it can handle all ports either broadcasting all serial ports to one netport or one to one connection so in stead of listing serial ports in a dropdown we can have a table with all ports each in raw with the corresponding netport and connect button + auto connect check.

it will be pefect. thanks.

soundanalogous commented 11 years ago
  1. Use the nodeJS version of breakout server: https://github.com/soundanalogous/Breakout/tree/master/node_server It doesn't currently have an "auto connect" mode, but you could write a shell script to launch the application with a known serial port name $ node node_server/server.js -p /dev/tty.usbmodemfd131 (or whatever your known serial port name is). I'm planning to add a basic auto connect ability to the nodeJS server in the near future. Trick is knowing which port on Windows (COMx) or Linux (ACMx) is associated with an arduino when there are multiple com ports listed. I do not intend to write a separate headless version of the Java-based server.
  2. Both the GUI (Java) and headless (nodeJS) versions of breakout server have a multi-connect mode which enables multiple clients to connect to a single board. To do the opposite however as you describe (a single net connection to multiple boards) is more complicated. It's been on my list of things to do for a long time but is relatively low priority. I'm open to contributions if this is something you or anyone else wants to work on. The Breakout JavaScript client can handle multiple connections (just instantiate each new IOBoard object with a unique port), but currently each board would need to be connected to a different computer or on a single computer running multiple instances of Breakout Server, each with a unique port number (so 8887 and 8889 for example). You'd have to install each version in a different director and launch them independently, which is not ideal.

Also regarding no. 2 above another option is to enable a websocket connection directly with the board (via an Ethernet or WiFi shield). This is likely too much for an Arduino Uno to handle, but it could work for a Due. It should also be possible with an Arduino Yun (I'm waiting for them to become available again so I get one and work on this). That way you don't need breakout server at all, you simply connect directly to the board from a JS application via a websocket connection.

ghost commented 11 years ago

Thanks alot for your reply. i think that contributing to this project would be pleasure so i intend to do so when i am done gathering all the needed ideas as i am thinking about making a bridge server not only for IO boards but also for other serial devices to make web guys having more capabilities of desktop apps. thanks

soundanalogous commented 11 years ago

Sounds good. Also, both versions of Breakout Server should also be work as a general purpose serial to websocket bridge. They just don't currently fully meet your requirements. I can also add the ability to connect at different baud rates (currently both server versions are fixed at 57600).

Chrome and Mozilla also have serial APIs. Each implementation is different though and I heard the Chrome version is changing. I haven't tried them yet but plan to make Breakout compatible once the dust has settled.

ghost commented 11 years ago

You know how it is hard to make SerialPort module run on widows so i really do not go with node-js. I have tries Chrome APIs but it is not a good choice as it makes your app chained to one browser and you have to work around sandbox. so i really like the idea about your java server as it is a standalone far from browsers and plugins compatibly and all that stuff. it is not a must to be in java may be in python but the idea of tunneling serial ports to websockets in really good.