mirror of
https://github.com/Xevion/go-ha.git
synced 2025-12-05 23:15:07 -06:00
Avoid panic on disconnect
This commit is contained in:
7
app.go
7
app.go
@@ -263,9 +263,12 @@ func (a *App) Start() {
|
||||
// entity listeners and event listeners
|
||||
elChan := make(chan ws.ChanMsg)
|
||||
go ws.ListenWebsocket(a.conn, a.ctx, elChan)
|
||||
var msg ws.ChanMsg
|
||||
|
||||
for {
|
||||
msg = <-elChan
|
||||
msg, ok := <-elChan
|
||||
if !ok {
|
||||
break
|
||||
}
|
||||
if a.entityListenersId == msg.Id {
|
||||
go callEntityListeners(a, msg.Raw)
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user