Single Job for Multiple Widgets
I have a single job gathering data over websockets and pushing it immediately (using job.pushUpdate
). I intended to have multiple widgets wired to this job. One would display text values, one would have a graph, etc.
But once I added the second widget, the first no longer received data (widget's onData
never called). Am I doing something wrong or is this not supported?
The dashboard grid widgets
contains:
{
"row" : 1, "col" : 1,
"width" : 1, "height" : 3,
"widget" : "events",
"job" : "events",
"config": "events"
},
{
"row" : 3, "col" : 2,
"width" : 1, "height" : 1,
"widget" : "events-chart",
"job" : "events",
"config": "events"
},
Comments (4)
-
reporter -
reporter I figured out what I was doing wrong. I did not realize that a new job instance would be created for each reference to that job in the dashboard json. The way I organized my code meant that only one
job.pushUpdate
would ever get called. Sorry! -
reporter - changed status to invalid
User error. Expected all references to a "job" to be the same instance of that job.
-
@williamking How did you fix this?
- Log in to comment
A couple of points:
setInterval
and push fake data, both widgets display data.In other words, both widgets work with real data so long as only one is on the board.