ground-dashboard/ground/dashboard/static/js/main.js
2022-12-03 18:55:43 +00:00

11 lines
300 B
JavaScript

(() => {
let data = []
const dashboard = new Dashboard(document.getElementById('main'))
dashboard.attach()
const webSocket = new WebSocket(`ws://${window.location.host}/api/data`)
webSocket.onmessage = (e) => {
data = data.concat(JSON.parse(e.data))
dashboard.update(data)
}
})()