update control WS.

This commit is contained in:
Miroslav Šedivý 2020-11-30 18:24:38 +01:00
parent 4bbf3bb039
commit 2e090eb54d
6 changed files with 42 additions and 95 deletions

View file

@ -39,9 +39,10 @@ func (h *MessageHandlerCtx) SessionConnected(session types.Session) error {
host := h.sessions.GetHost()
if host != nil {
if err := session.Send(
message.Control{
Event: event.CONTROL_LOCKED,
ID: host.ID(),
message.ControlHost{
Event: event.CONTROL_HOST,
HasHost: true,
HostID: host.ID(),
}); err != nil {
return err
}
@ -65,9 +66,9 @@ func (h *MessageHandlerCtx) SessionDisconnected(session types.Session) error {
h.sessions.ClearHost()
h.sessions.Broadcast(
message.Control{
Event: event.CONTROL_RELEASE,
ID: session.ID(),
message.ControlHost{
Event: event.CONTROL_HOST,
HasHost: false,
}, nil)
}