Closed kornpow closed 3 years ago
It is correct that the WebSocket proxy doesn't respond to ping messages. If that means it's not fully compliant with the RFC then that should probably be changed. When testing with the node-js implementation (https://github.com/websockets/ws) this issue never came up as that library doesn't seem to care about ping/pong requests (or at least doesn't require them).
To get your code working: If you use ping_timeout=None,ping_interval=99999
, do you still see instability?
As long as the client library doesn't expect a response to pings, the connection should remain open and stable.
We'll try to get a fix for the pong responses in, hopefully for v0.11.1
.
Any plans for this feature to be in some next release? Would be awesome to have since there's currently no way to check if a websocket connection is still open
When running LND behind an NGINX proxy unless you add some long timeouts to the nginx config it automatically cancels the websocket connection if it has no activity for a while. This could also be avoided with the ping-pong messages so that you can forcefully keep open the connection even if no messages are being transmitted through the websocket (apart from the ping-pong)
I spent few days debugging exactly the same problem with gRPC https://github.com/ninenines/gun/issues/230#issuecomment-704823789
Background
When using the rest websocket proxy, some websocket clients send periodic pings, and expect to receive pongs, or else it will close the connection. It doesn't appear as if LND is responding to those pings, so additional flags need to be used to prevent accidental closes of the websocket.
I am trying to use the REST '/v2/router/htlcevents' endpoint stream.
Your environment
lnd
"version": "0.10.1-beta commit=clock/v1.0.0-250-ga39c91fbcb9b002c93cae3432771b295ea4a942c-dirty", "commit_hash": "a39c91fbcb9b002c93cae3432771b295ea4a942c",uname -a
on *Nix) ubuntubtcd
,bitcoind
, or other backend bitcoindSteps to produce
This is the stack overflow page that described the result of my issue: https://github.com/miguelgrinberg/python-socketio/issues/310
Code example:
When I opened my websocket as such I received a "no pong received error":
However, opening up the socket as so, telling it to ignore missing pongs, I am able to keep the socket alive long term:
What do you think? Is it bad that its not responding the pings with pongs? According to the linked stackoverflow the issue is non-compliance with: https://tools.ietf.org/html/rfc6455#section-5.5.3