'Using web sockets with C++ and set the object protocol

I'm a complete beginner to all things HTTP and Websockets. I am trying to figure out how to setup a websocket for this specific example:

https://docs.automata.tech/v/4.11.1/api/data/#stream

It states, to start the stream I need to start by sending an HTTP request with the following data:

GET /api/v1/data/stream
Host: eva.automata
Accept: */*
Upgrade: websocket
Connection: Upgrade
Sec-WebSocket-Key: SGVsbG8sIHdvcmxkIQ==
Sec-WebSocket-Version: 13
Sec-Websocket-Protocol: SessionToken_<session-token>, object

I've tried looking into "https://github.com/dhbaird/easywsclient".

The example on the GitHub page shows starting a connection with:

static pointer from_url(std::string url);

I'm guessing some of the underlying setup is done by the library by default. I don't understand how I would set the Sec-Websocket-Protocol.

I've also looked into Microsoft's Rest SDK library:

https://microsoft.github.io/cpprestsdk/classweb_1_1websockets_1_1client_1_1websocket__client.html

I'm struggling to get my head around how I would setup the protocol with this library, too.

I seem to be missing a lot of understanding. Could somebody recommend topics I need to learn to start gaining some sort of clue on what I need to do here?

A working example on how to setup a WebSocket in my specific case is also appreciated.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source