Plug an arduino to connect it as a websocket

View project on GitHub

LibreConnect Banner

Build your own applications

Once your arduino is connected, you can send/receive command using JavaScript.
Websocket Browsers

Check out libreInterface for more examples.


Check out this example


The easiest way to control arduino is to build a static web page.
You just need to create an HTML file.

var ws = new WebSocket('ws://localhost:42000');
Here is an example to send message
<button onclick="ws.send('ON')">ON</button>
<button onclick="ws.send('OFF')">OFF</button>

Here is an HTML example to send/receive message :

Web Browser Dev Console

You can use the console of your browser to try it.

ws = new WebSocket('ws://localhost:42000');


You can also build a websocket client in NodeJS (or python …), if you want to

  • Log data from a sensor to a database.
  • Automate Tasks
  • Centralize websockets and expose it in a secure application

It works almost like a HTML/JS code so you can prototype your application on a web browser.

// Install: npm i rwebsocket -S
WebSocket = require('rwebsocket');
var ws = new WebSocket('ws://localhost:42000');

Here is a basic example to log temperature/humidity on a CSV file :


LibreInterface is an HTML/JS editor you can use on your web browser, It works offline. You can export/import your code with JSON.