Single Job for Multiple Widgets

Issue #126 invalid
William King created an issue

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)

  1. William King reporter

    A couple of points:

    • When I use setInterval and push fake data, both widgets display data.
    • With real data, when I remove either widget, the other widget works fine.

    In other words, both widgets work with real data so long as only one is on the board.

  2. William King 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!

  3. Log in to comment