python-can remote for JavaScript
This package adds CAN capabilities to JavaScript by communicating with the python-can-remote server over WebSocket. It works both in Node.js and in modern browsers.
Quick start
Install python-can on the computer hosting the physical CAN-bus:
$ pip install python-can
Start the server and specify which interface and channel to share. Many interfaces are supported. See the documentation for python-can.
$ python -m can_remote --interface=socketcan --channel=can0$ python -m can_remote --interface=kvaser --channel=0 --bitrate=500000$ python -m can_remote --interface=pcan --channel=PCAN_USBBUS1 --bitrate=500000$ python -m can_remote --interface=ixxat --channel=0 --bitrate=500000
When using Node.js or a bundler like webpack or browserify, install this package as a dependency to your project.
$ npm install --save python-can-remote
Alternatively you can include this in a script tag in your HTML.
Here is an example of what you can do:
// Skip this if you have included it as a script tag earliervar Bus = ; // Any configuration options will be passed as is when connecting to the busvar config = can_filters: can_id: 0x123 can_mask: 0xfff extended: false receive_own_messages: true;var bus = 'ws://localhost:54701/' config; bus; bus; bus; bus; ;