mirror of
https://github.com/m1k1o/neko.git
synced 2024-07-24 14:40:50 +12:00
WS do not connect if already connected.
This commit is contained in:
parent
1677e38935
commit
25fec63455
@ -135,6 +135,19 @@ func (ws *WebSocketManagerCtx) Upgrade(w http.ResponseWriter, r *http.Request) e
|
||||
return connection.Close()
|
||||
}
|
||||
|
||||
if session.Connected() {
|
||||
// TODO: Refactor
|
||||
if err = connection.WriteJSON(
|
||||
message.SystemDisconnect{
|
||||
Event: event.SYSTEM_DISCONNECT,
|
||||
Message: "already connected",
|
||||
}); err != nil {
|
||||
ws.logger.Error().Err(err).Msg("failed to send disconnect")
|
||||
}
|
||||
|
||||
return connection.Close()
|
||||
}
|
||||
|
||||
session.SetWebSocketPeer(&WebSocketPeerCtx{
|
||||
session: session,
|
||||
ws: ws,
|
||||
|
Loading…
Reference in New Issue
Block a user