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
x/net/websocket: server should ping on an interval #5958
Comments
3 year later, and nothing had happened yet. |
@klausenbusk, see https://golang.org/wiki/NoMeToo Perhaps you can elaborate on why this is a problem for you in practice? Can you describe your environment? Do underlying TCP keep-alive mechanisms not adequately cull dead connections? |
Haproxy removes connections that have not pinged for X minutes. So golang websocket connections are cut off every 2 minutes in my case. |
TCP keep alive != websocket keepalive because in the case there is a proxy between the client and server, tcp keepalives will go between the proxy and each endpoint, whereas websocket ping pong works and to end. |
You can 'manually' send a ping frame - what is worse tho is that whether the remote side sends a pong in response or not, makes no difference - it is discarded, with no api to allow the client code to respond to a dead client. I suspect the intention of |
@danmux any hint on how pings could be sent manually? The marshalling function looks like this: func marshal(v interface{}) (msg []byte, payloadType byte, err error) {
switch data := v.(type) {
case string:
return []byte(data), TextFrame, nil
case []byte:
return data, BinaryFrame, nil
}
return nil, UnknownFrame, ErrNotSupported
} It is either text or binary, with no way to set the type to PingFrame. |
|
@klausenbusk thanks, appreciated! |
why is it still open issue? |
@mkungla, because it's not yet implemented. Or are you asking why people haven't prioritized fixing this? |
Thanks everyone for the engagement on this issue, and for the patience. We no longer maintain x/net/websocket and instead recommend these libraries: But at least a work around of manual pings was suggested by @danmux in #5958 (comment), and code was provided by @klausenbusk in #5958 (comment). Thus, I shall close this issue. Thank you again. |
The text was updated successfully, but these errors were encountered: