Say I create a node.js script in my browser and send the compiled script over usb to the BBB.
From a high-level programming side, how is the data stream from usb processed on the board?
The USB client port runs a composite gadget driver making it look to the host computer like a serial port, storage device and network adapter. The network adapter driver is the one used for access. It seems to the host like it has a network adapter and the BeagleBone has another one and that they are connected on the network. The BeagleBone hard-fixes its network address as 192.168.7.2 and offers up 192.168.7.1 to the host using DHCP. The result is you can talk between the two computers just like over Ethernet or WiFi.
What applications/files are utilized to get the data to perform a task (like turn on a gpio)? How does the input interact with the linux os? Does this require webserver httprequests on the BBB side or is it processed another way such as non-http shell scripts or maybe without the linux system at all? (I assume not)
The BoneScript web server sits on top of the BoneScript library and utilizes socket.io to create remote procedure calls to the functions running on the web server. Essentially, the web server will call the same functions locally on the board that you could call if you were running a node.js application, ‘required’ the BoneScript library and made the calls locally.
The goal of my question is to understand the difference between the mechanics of using bonescript with BBB as opposed to SSHing files into the file system.
BoneScript can be used either locally by using node.js and reading in the library or embedded into any web page by utilizing the web server that is running on the BeagleBone by default. Utilizing the web server isn’t very secure, but it can make doing quick demos really easy. The goal is to show just how easy it can be to integrate I/O elements into a web page.
If you run scripts local to the board, you can use the BoneScript library on node.js, but you can also use one of the Python, C/C++, Ruby, Go, or dozens of other libraries that either use the Linux interfaces or mmap the peripheral control registers.