Programming interface
3.5 Code examples
SIMATIC RTLS4083T
22
Operating Instructions, 12/2019, C79000-G8976-C527-02
console.log("load configuration")
try {
var config = require('./config.json')
} catch (e) {
console.error(e)
process.exit(1);
}
console.log("load autobahn")
try {
var autobahn = require('autobahn')
} catch (e) {
console.error(e)
process.exit(1);
}
console.log("connect to wamp-router", config.wamp.name)
var connection = new autobahn.Connection({
url: config.wamp.url,
realm: config.wamp.realm,
max_retries: 1,
authmethods: ['wampcra'],
authid: config.wamp.user,
onchallenge: function (session, method, extra) {
if (method === "wampcra") {
return autobahn.auth_cra.sign(config.wamp.key, extra.challenge);
}
}
});
connection.onopen = function (session) {
console.log("connected to wamp-router", config.wamp.name)
if ( config.debug ) console.info("check epaper api tags")
session.call("agilion.wls.epaper.get_tags").then(
function (res) {
/*if ( config.debug ) console.log("epaperapi response:", res);*/
for (let etag of config.tagwhitelist){