-
Notifications
You must be signed in to change notification settings - Fork 25
Websocket API for client application
The BlocklyProp browser (client-side) javascript contains a websocket listener, normally on port 6009 of localhost, that allows a client application to serve as the intermediary between the browser-based web app and the Propeller hardware, usually via a USB connection.
The API below describes the JSON strings that can be sent or received between the browser and the application.
Here's what the BlocklyProp-Client/BlocklyProp-Launcher (application) will listen for:
-
type: 'load-prop'
-
action: 'RAM' | 'EEPROM' // String specifying action for loader
-
payload: // String base64 encoded Propeller image or ELF file to load (generated by Prop-GCC)
-
debug: 'none' | 'terminal' | 'graph' // Follow up action
-
portPath: // String path for chrome.serial to use
-
success: // unused, may need for callback/error handling
-
type: 'serial-terminal'
-
action: 'open' | 'close'
-
portPath: // String path used by chrome.serial
-
baudrate: // Integer baudrate
-
msg: // String message/text content
-
type: 'port-list-request' // request to send list of available serial ports
-
type: 'hello-browser' // request for hello-client response including version
-
baudrate: // Integer baudrate for serial connections, 115200 if undefined
Here is what the BlocklyProp site (browser) will listen for:
-
type: 'hello-client',
-
version: //String version (semantic versioning)
-
type: 'port-list',
-
ports: // Array of Strings list of ports used by chrome.serial
-
type: 'serial-terminal'
-
msg: // String message/text to be sent to the graph or terminal (whichever is open)
-
type: 'ui-command',
-
action: 'open-terminal' | 'open-graph' | 'close-terminal' | 'close-graph' | 'close-compile' | 'clear-compile' | 'message-compile' | 'alert' | 'console-log'
-
msg: // String message/text content
The 'ui-command' allows the BP-launcher/client to open, close, and message "modal" pop-ups like the compiler dialog and for opening and closing the terminal or graph.