c++boostwebsocketcoinbase-apibeast-websockets

How to use boost::beast to connect to Coinbase's websocket API


I'm a bit new to websocket programming. I've been trying to use this example :- https://www.boost.org/doc/libs/develop/libs/beast/example/websocket/client/async-ssl/websocket_client_async_ssl.cpp to connect to the coinbase websocket api over here :- https://docs.pro.coinbase.com/#websocket-feed

However, I keep getting 400 - Bad Request in the response on wireshark.

Here is a snapshot of my TCP request :- enter image description here

Any idea what I might be doing wrong here?


Solution

  • So turns out I am really new to web programming. The standard TLS port is 443. Also, coinbase's TLS api requires you to only set the hostname in the SNI field and not the hostname:port

    Otherwise, the example worked as is!