event SystemDisconnect.

This commit is contained in:
Miroslav Šedivý 2020-12-01 19:44:23 +01:00
parent 21293256ed
commit 1b6bc44f2a
3 changed files with 6 additions and 11 deletions

View File

@ -84,7 +84,7 @@ func (session *SessionCtx) SetWebRTCConnected(connected bool) {
func (session *SessionCtx) Disconnect(reason string) error { func (session *SessionCtx) Disconnect(reason string) error {
if err := session.Send( if err := session.Send(
message.Disconnect{ message.SystemDisconnect{
Event: event.SYSTEM_DISCONNECT, Event: event.SYSTEM_DISCONNECT,
Message: reason, Message: reason,
}); err != nil { }); err != nil {

View File

@ -23,7 +23,6 @@ type SystemAdmin struct {
BroadcastStatus BroadcastStatus `json:"broadcast_status"` BroadcastStatus BroadcastStatus `json:"broadcast_status"`
} }
// TODO: New.
type SystemDisconnect struct { type SystemDisconnect struct {
Event string `json:"event,omitempty"` Event string `json:"event,omitempty"`
Message string `json:"message"` Message string `json:"message"`
@ -139,11 +138,6 @@ type BroadcastStatus struct {
URL string `json:"url,omitempty"` URL string `json:"url,omitempty"`
} }
// TODO: Remove.
type Disconnect struct {
Event string `json:"event"`
Message string `json:"message"`
}
// TODO: Remove. // TODO: Remove.
type MembersList struct { type MembersList struct {

View File

@ -124,7 +124,8 @@ func (ws *WebSocketManagerCtx) Upgrade(w http.ResponseWriter, r *http.Request) e
ws.logger.Warn().Err(err).Msg("authentication failed") ws.logger.Warn().Err(err).Msg("authentication failed")
// TODO: Refactor // TODO: Refactor
if err = connection.WriteJSON(message.Disconnect{ if err = connection.WriteJSON(
message.SystemDisconnect{
Event: event.SYSTEM_DISCONNECT, Event: event.SYSTEM_DISCONNECT,
Message: "authentication failed", Message: "authentication failed",
}); err != nil { }); err != nil {