2018-06-30 16:20:54 +02:00
|
|
|
package websocket
|
|
|
|
|
|
|
|
import (
|
2018-07-26 14:14:23 +02:00
|
|
|
wsLib "dev.sum7.eu/genofire/golang-lib/websocket"
|
2018-06-30 16:20:54 +02:00
|
|
|
|
|
|
|
yanicRuntime "github.com/FreifunkBremen/yanic/runtime"
|
|
|
|
|
|
|
|
"github.com/FreifunkBremen/freifunkmanager/runtime"
|
|
|
|
)
|
|
|
|
|
|
|
|
func (ws *WebsocketServer) SendNode(node *runtime.Node, system bool) {
|
|
|
|
msgType := MessageTypeCurrentNode
|
|
|
|
if system {
|
|
|
|
msgType = MessageTypeSystemNode
|
|
|
|
}
|
|
|
|
ws.ws.SendAll(&wsLib.Message{Subject: msgType, Body: node})
|
|
|
|
}
|
|
|
|
|
|
|
|
func (ws *WebsocketServer) SendStats(data *yanicRuntime.GlobalStats) {
|
|
|
|
ws.ws.SendAll(&wsLib.Message{Subject: MessageTypeStats, Body: data})
|
|
|
|
}
|