Support websocket event to send server stats; ref pterodactyl/panel#2414
This commit is contained in:
parent
3655b172f3
commit
a0fa5a94b6
|
@ -8,6 +8,7 @@ const (
|
|||
SetStateEvent = "set state"
|
||||
SendServerLogsEvent = "send logs"
|
||||
SendCommandEvent = "send command"
|
||||
SendStatsEvent = "send stats"
|
||||
ErrorEvent = "daemon error"
|
||||
JwtErrorEvent = "jwt error"
|
||||
)
|
||||
|
|
|
@ -360,6 +360,16 @@ func (h *Handler) HandleInbound(m Message) error {
|
|||
})
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
case SendStatsEvent:
|
||||
{
|
||||
b, _ := json.Marshal(h.server.Proc())
|
||||
h.SendJson(&Message{
|
||||
Event: server.StatsEvent,
|
||||
Args: []string{string(b)},
|
||||
})
|
||||
|
||||
return nil
|
||||
}
|
||||
case SendCommandEvent:
|
||||
|
|
Loading…
Reference in New Issue
Block a user