unserverjs is a javascript client library for Unserver - Modbus Communication Software.
Unserver is a program that acts as an RESTful HTTP API for underlying Modbus networks and offers I/O functionality similar to OPC servers, including:
- polling
- caching
- custom tags
- data type conversion
Unserver documentation and getting started
Download unserver.js and include it into your web page.
Check your Unserver configuration to see which port is used the API.
var client = new Unserver('http://127.0.0.1:9000');
See Unserver tags to setup tags.
u.watchProperty('tag1.property1', function(val){
console.log('new value: ' + val);
});
u.startPolling(1000);
u.setProperty('tag1.property1', 0);
u.setProperty('tag1.property1', 1, function(){
console.log("success");
}, function(){
console.log("failure");
});