beast icon indicating copy to clipboard operation
beast copied to clipboard

More complete SSL websocket example

Open gitgitwhat opened this issue 3 years ago • 5 comments

I'm wondering if there are more complete examples available for SSL websockets besides just sending a single message and shutting down. For example, how do you keep the connection alive after the on_handshake? And does a message have to be sent at that time? I have a pretty typical websocket client use case but just having trouble with some of the boost::beast basics.

gitgitwhat avatar Jul 04 '21 04:07 gitgitwhat

Timeouts and keep-alives are not specific to SSL connections. Have you had a look at this? https://www.boost.org/doc/libs/1_76_0/libs/beast/doc/html/beast/using_websocket/timeouts.html

vinniefalco avatar Jul 04 '21 04:07 vinniefalco

Thanks @vinniefalco I found your CppCon2018 talk and have been looking through that. It is helpful to understand how the server works but my client isn't a browser so still need to figure out how to extend the existing client examples to do a back and forth.

Unrelated, curious if you have ever done any performance and scaling tests on the various threading models. I've read about websocket servers written in Golang that can handle 1M+ concurrent connections on relatively modest hardware. I'd assume something written in C++ could do that just as easily.

gitgitwhat avatar Jul 04 '21 15:07 gitgitwhat

Beast/asio is limited only by the hardware and OS. I can confirm that massively scaling is possible with beast and works well. I did this when working for a cryptocurrency exchange.

madmongo1 avatar Jul 04 '21 20:07 madmongo1

Thanks @madmongo1 I assumed as much.

Can you share any write ups, code examples, or gotchas to achieve scale? It's a interesting problem that I'm just not that familiar with but want to learn.

gitgitwhat avatar Jul 04 '21 20:07 gitgitwhat

Late here now but I’ll write something in it after I’ve competed this months blog (which covers some epic new features about to be released in asio)

madmongo1 avatar Jul 04 '21 20:07 madmongo1

Hy, This issue seems interesting to me Although I currently don't have sufficient knowledge regarding the technicality I would still like to ask if I can give it a try to document it. This process will also let me learn the technical aspect and also about the contribution in this repo. Maybe you can give me instructions on what you want to get completed in the documentation

amanbadone avatar Dec 06 '22 18:12 amanbadone