-
-
Notifications
You must be signed in to change notification settings - Fork 50
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Websocket - Disconnect after every ~1 hour - need support #220
Comments
This is a very good idea and I personally also already thought about adapting iobroker.unifi to use websockets for status updates somehwere in the future, but I didn't find the time yet, actually. So please go ahead!
First of all, the websocket support in node-unifi is definitely not final and more or less in an early state. So there might be easily some shortcomings especially when used in such a complex environment/use case like iobroker.unifi. So there might be some issues with the ping/pong mechanism used to keepalive the websocket connect, but in the end we might need some smarter reconnection mechanism for long lived websocket connection, e.g. if network connectivity is not really stable (cf. https://stackoverflow.com/questions/50197453/how-long-can-a-websocket-connection-last).
Thx, to me this looks fine so far. However, before integrating this in iobroker.unifi I would propose to create a simple nodejs test example for establishing a long-lived websocket connection (e.g. which is based on the websocket example) and then see if the same issue appears there and then try to work out a solution in node-unifi for it. |
I followed your suggestion and used a simple nodejs program to test. nodejs test code:
and the log: Maybe you can have a look at the implementation of the unifi-protect adapter. It also uses the websocket interface and can keep the connection permanently open. |
I am currently playing around with the websocket interface, with the long term goal of integrating this into the iobroker unifi adapter.
I noticed that the websocket interface always stops working after about an hour, i have done serveral test.
Unfortunately I do not get on now and need please support
Here you can find my test code:
https://github.com/Scrounger/ioBroker.unifi/blob/1349aa3607ef147c66b2be3cc8acebfa9dfea6bb/main.js#L1423
And here are two logs of one run, all others show the same behaviour:
unifi-ws-log-1.log
unifi-ws-log-2.log
Test setup:
UDM Pro: v3.1.16 (Unifi OS)
Network: 7.5.176
The text was updated successfully, but these errors were encountered: