A Client side framework that talks with Serial Port Json Server
This project aims to create a functional javascript client-library, that talks to the Serial Port Json Server over a Websocket. It also abstracts the device communication to a unified api.
- Only functional, no connection to the DOM
- Writen in Vanilla.js
- Creates an easy to use and understand API / SDK
- Tested
- Support for:
- Smoothieboard
- Grbl
- TinyG
start SPJS (version 1.80 or higher);
npm install
npm run dev
This is for the react.js app that integrates with the spjc librarie that way we can test and interact with the server over our client. In the end we are only intrested in src/js/spjc.js
.
Include script <script type="text/javascript" src="/js/lib/spjc.js"></script>
create object var spjc = new Spjc('localhost')
and connects to SPJS
spjc.connect(host)
host = 'localhost' or '127.0.0.1' (default = localhost) connects the client with the server
spjc.setUrl(host)
host = 'localhost' or '127.0.0.1' (default = localhost) sets the full url for making the connection with the server
spjc.disconnect()
disconnects the client from the server
spjc.restartSPJS()
restarts the SPJS server, after 10 seconds the client attempts to reconnect with the server.
spjc.getList()
this will ask the SPJS for a list of all serial ports. This will trigger an 'Update' Event when the server responds.
spjc.getBufferAlgorithms()
this will ask the SPJS for a list of all buffer algorithms. This will trigger an 'Update' Event when the server responds.
... to be continued :-)