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 {
|
type Member struct {
|
||||||
Event string `json:"event"`
|
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 {
|
type MemberDisconnected struct {
|
||||||
|
@ -69,12 +69,10 @@ func (h *MessageHandlerCtx) SessionConnected(session types.Session) error {
|
|||||||
if err := h.sessions.Broadcast(
|
if err := h.sessions.Broadcast(
|
||||||
message.Member{
|
message.Member{
|
||||||
Event: event.MEMBER_CONNECTED,
|
Event: event.MEMBER_CONNECTED,
|
||||||
Member: &message.MembersListEntry{
|
|
||||||
ID: session.ID(),
|
ID: session.ID(),
|
||||||
Name: session.Name(),
|
Name: session.Name(),
|
||||||
Admin: session.Admin(),
|
Admin: session.Admin(),
|
||||||
Muted: session.Muted(),
|
Muted: session.Muted(),
|
||||||
},
|
|
||||||
}, nil); err != nil {
|
}, nil); err != nil {
|
||||||
h.logger.Warn().Err(err).Msgf("broadcasting event %s has failed", event.CONTROL_RELEASE)
|
h.logger.Warn().Err(err).Msgf("broadcasting event %s has failed", event.CONTROL_RELEASE)
|
||||||
return err
|
return err
|
||||||
|
@ -231,11 +231,7 @@ func (ws *WebSocketManagerCtx) handle(connection *websocket.Conn, id string) {
|
|||||||
|
|
||||||
for {
|
for {
|
||||||
_, raw, err := connection.ReadMessage()
|
_, raw, err := connection.ReadMessage()
|
||||||
if err == nil {
|
if err != nil {
|
||||||
bytes <- raw
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
|
|
||||||
if websocket.IsUnexpectedCloseError(err, websocket.CloseGoingAway, websocket.CloseAbnormalClosure) {
|
if websocket.IsUnexpectedCloseError(err, websocket.CloseGoingAway, websocket.CloseAbnormalClosure) {
|
||||||
ws.logger.Warn().Err(err).Msg("read message error")
|
ws.logger.Warn().Err(err).Msg("read message error")
|
||||||
} else {
|
} else {
|
||||||
@ -243,6 +239,10 @@ func (ws *WebSocketManagerCtx) handle(connection *websocket.Conn, id string) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
close(cancel)
|
close(cancel)
|
||||||
|
break
|
||||||
|
}
|
||||||
|
|
||||||
|
bytes <- raw
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user