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 {
if err := session.Send(
message.Disconnect{
message.SystemDisconnect{
Event: event.SYSTEM_DISCONNECT,
Message: reason,
}); err != nil {

View File

@ -23,7 +23,6 @@ type SystemAdmin struct {
BroadcastStatus BroadcastStatus `json:"broadcast_status"`
}
// TODO: New.
type SystemDisconnect struct {
Event string `json:"event,omitempty"`
Message string `json:"message"`
@ -139,11 +138,6 @@ type BroadcastStatus struct {
URL string `json:"url,omitempty"`
}
// TODO: Remove.
type Disconnect struct {
Event string `json:"event"`
Message string `json:"message"`
}
// TODO: Remove.
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")
// TODO: Refactor
if err = connection.WriteJSON(message.Disconnect{
if err = connection.WriteJSON(
message.SystemDisconnect{
Event: event.SYSTEM_DISCONNECT,
Message: "authentication failed",
}); err != nil {