boostorg / boostorg/beast

Better explanation of tcp_stream timeouts and websocket interaction

Open
#1,726 7 comments 0 reactions 0 assignees View on GitHub
Doc
Dominant language
C++
Stars
4.8k
Forks
694
Avg merge
12h 48m
Merged PRs (30d)
1

Description

https://www.boost.org/doc/libs/1_71_0/libs/beast/doc/html/beast/using_websocket/timeouts.html says

`The timeout features of the TCP or basic stream should not be used when working with a websocket stream.`

and

`The timeouts on the websocket stream are incompatible with the timeouts used in the tcp_stream. When constructing a websocket stream from a tcp stream that has timeouts enabled, the timeout should be disabled first before constructing the websocket stream, as shown.`

I wanted to have a timeout for the "connection" of a protocol over websocket, with the timeout covering all of TCP, SSL, Websocket and over-Websocket.

So I was planning to use the tcp_stream timeout starting with the TCP socket and only stopped after the websocket handshake.

I was planning to disable the WS handshake_timeout, but leaving the WS idle_timeout. But the documentation seems to say I can't. Can the restriction be relaxed?
I am not really sure why it's there. The WS stream needs to be able to work even if the underlying streams report an error and AFAIK an error::timeout is just another error.
Maybe the documentation is just trying to say "your handshake may timeout earlier than expected if there is also a tcp_stream timeout"?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.