mirror of
https://github.com/m1k1o/neko.git
synced 2024-07-24 14:40:50 +12:00
event SystemDisconnect.
This commit is contained in:
parent
21293256ed
commit
1b6bc44f2a
@ -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 {
|
||||
|
@ -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 {
|
||||
|
@ -124,10 +124,11 @@ 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{
|
||||
Event: event.SYSTEM_DISCONNECT,
|
||||
Message: "authentication failed",
|
||||
}); err != nil {
|
||||
if err = connection.WriteJSON(
|
||||
message.SystemDisconnect{
|
||||
Event: event.SYSTEM_DISCONNECT,
|
||||
Message: "authentication failed",
|
||||
}); err != nil {
|
||||
ws.logger.Error().Err(err).Msg("failed to send disconnect")
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user