htmlrubydashing

Dashing job get_event?


In my dashboard I have a job where I would like to get a value from my widget.

# :first_in sets how long it takes before the job is first run. In this case, it is run immediately
SCHEDULER.every '1s', :first_in => 0 do |job|
  send_event('my_widget', { value: rand(400) })
end

This is the code to send data to my widget, but how could I get the data? What is the "get_event" that I'm looking for?


Solution

  • From this issue in dashing github repository, You can use server sent events to get data from dashing dashboard.

    Dashing provides data from the same API end point

    http://dashingdemo.herokuapp.com/events

    Excerpt from returned data

    data: {"current":77,"last":82,"id":"valuation","updatedAt":1461840437}

    data: {"current":104578,"last":89199,"id":"karma","updatedAt":1461840437}

    data: {"value":62,"id":"synergy","updatedAt":1461840437}