cflurin / homebridge-websocket

Homebridge Plugin
Apache License 2.0
40 stars 7 forks source link

Second connection to Websocket host breaks communication to first connection. #15

Closed brannon-bowden closed 3 years ago

brannon-bowden commented 5 years ago

I'm running into an issue, that I can't quite narrow down. I basically end up in a state where my websocket client quits receiving MOST (but not all) data. I can reproduce the issue by simply connecting a second client to the same websocket port as my first. The first client will stay connected, but quits receiving data, and the second one starts receiving it all. I have to disconnect both clients, and then reconnect the main one for it to start working again.

Do you happen to have any thoughts?

brannon-bowden commented 5 years ago

Looks like this page has some insight on how to resolve, https://stackoverflow.com/questions/32960956/nodejs-websocket-node-module-how-to-make-multi-client-socket-server-works

brannon-bowden commented 5 years ago

Got this working based on the stackoverflow, albeit I am not removing disconnected connections from the array yet, so need to sort that out. I will try to create a PR asap.

brannon-bowden commented 5 years ago

Partially Resolved with the following pull request, but need some help with cleaning up disconnected sessions. https://github.com/cflurin/homebridge-websocket/pull/16

cflurin commented 5 years ago

Hi, I don't use homebridge-websocket anymore. As an alternative try homebridge-mqtt. If you can't use homebridge-mqtt, I'll have a look at it but just now I'm working on an other project.