diff --git a/etc/websocket-demo.conf b/etc/websocket-demo.conf index 0cf07e05f..ee7d6cc62 100644 --- a/etc/websocket-demo.conf +++ b/etc/websocket-demo.conf @@ -33,42 +33,51 @@ nodes = { signal = "mixed", values = 5, rate = 20, - hooks = ( - { type = "stats" } - ) - }, - stats = { - type = "stats", - node = "sig", - rate = 10, + in = { + hooks = ( + { type = "stats" } + ) + } }, ws_sig = { type = "websocket", description = "Demo Channel", - series = ( - { label = "Random walk", unit = "V" }, - { label = "Sine", unit = "A" }, - { label = "Rect", unit = "Var"}, - { label = "Ramp", unit = "°C" } - ), - hooks = ( - { type = "stats" } - ) + out = { + signals = ( + { name = "Random walk", unit = "V", type = "float" }, + { name = "Sine", unit = "A", type = "float" }, + { name = "Rect", unit = "Var", type = "float" }, + { name = "Ramp", unit = "°C", type = "float" } + ), + } + in = { + signals = ( ) + hooks = ( + { type = "stats" }, + { type = "print" } + ) + } }, - ws_stats = { + + ws_lo = { type = "websocket", - description = "Statistics", - series = ( - #{ label = "owd.total" } - { label = "owd.last" }, - { label = "owd.highest" }, - { label = "owd.lowest" }, - { label = "owd.mean" }, - { label = "owd.variance", yaxis = 2 } - ) - hooks = ( - { type = "stats" } - ) + description = "Loopback", + out = { + signals = ( + { name = "slider", type = "float" }, + { name = "buttons", type = "float" } + ), + } + in = { + signals = ( + { name = "slider", type = "float" }, + { name = "buttons", type = "float" } + ) + hooks = ( + { type = "stats" }, + { type = "print" } + ) + } } }; @@ -80,7 +89,7 @@ paths = ( out = "ws_sig" }, { - in = "stats.data[31-35]", # OWD - out = "ws_stats" + in = "ws_lo", + out = "ws_lo" } ); diff --git a/web/socket/app.js b/web/socket/app.js index b1168ec94..dbaa467df 100644 --- a/web/socket/app.js +++ b/web/socket/app.js @@ -202,8 +202,10 @@ function updatePlot() } } - if (currentNode.series !== undefined && currentNode.series[i] !== undefined) - $.extend(true, data[i], currentNode.series[i]); + if (currentNode.out.signals !== undefined && currentNode.out.signals[i] !== undefined) + $.extend(true, data[i], { + label : currentNode.out.signals[i].name + }); } var options = {