mirror of
https://github.com/m1k1o/neko.git
synced 2024-07-24 14:40:50 +12:00
bug fixes.
This commit is contained in:
parent
5d906e0a8b
commit
9559edf4d4
@ -41,7 +41,10 @@ type MembersListEntry struct {
|
||||
|
||||
type Member struct {
|
||||
Event string `json:"event"`
|
||||
Member *MembersListEntry
|
||||
ID string `json:"id"`
|
||||
Name string `json:"displayname"`
|
||||
Admin bool `json:"admin"`
|
||||
Muted bool `json:"muted"`
|
||||
}
|
||||
|
||||
type MemberDisconnected struct {
|
||||
|
@ -69,12 +69,10 @@ func (h *MessageHandlerCtx) SessionConnected(session types.Session) error {
|
||||
if err := h.sessions.Broadcast(
|
||||
message.Member{
|
||||
Event: event.MEMBER_CONNECTED,
|
||||
Member: &message.MembersListEntry{
|
||||
ID: session.ID(),
|
||||
Name: session.Name(),
|
||||
Admin: session.Admin(),
|
||||
Muted: session.Muted(),
|
||||
},
|
||||
}, nil); err != nil {
|
||||
h.logger.Warn().Err(err).Msgf("broadcasting event %s has failed", event.CONTROL_RELEASE)
|
||||
return err
|
||||
|
@ -231,11 +231,7 @@ func (ws *WebSocketManagerCtx) handle(connection *websocket.Conn, id string) {
|
||||
|
||||
for {
|
||||
_, raw, err := connection.ReadMessage()
|
||||
if err == nil {
|
||||
bytes <- raw
|
||||
continue
|
||||
}
|
||||
|
||||
if err != nil {
|
||||
if websocket.IsUnexpectedCloseError(err, websocket.CloseGoingAway, websocket.CloseAbnormalClosure) {
|
||||
ws.logger.Warn().Err(err).Msg("read message error")
|
||||
} else {
|
||||
@ -243,6 +239,10 @@ func (ws *WebSocketManagerCtx) handle(connection *websocket.Conn, id string) {
|
||||
}
|
||||
|
||||
close(cancel)
|
||||
break
|
||||
}
|
||||
|
||||
bytes <- raw
|
||||
}
|
||||
}()
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user