STTNet
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Static Public Member Functions | List of all members
stt::data::WebsocketStringUtil Class Reference

Responsible for string operations related to the WebSocket protocol. More...

#include <sttnet_English.h>

Static Public Member Functions

static std::string & transfer_websocket_key (std::string &str)
 Generate the Sec-WebSocket-Accept field value in the WebSocket handshake response. More...
 

Detailed Description

Responsible for string operations related to the WebSocket protocol.

Member Function Documentation

static std::string& stt::data::WebsocketStringUtil::transfer_websocket_key ( std::string &  str)
static

Generate the Sec-WebSocket-Accept field value in the WebSocket handshake response.

Based on the Sec-WebSocket-Key provided by the client, this function concatenates the WebSocket-specified magic GUID, then performs SHA-1 hashing and Base64 encoding to obtain the accept string required for the handshake response.

Parameters
strThe input is the Sec-WebSocket-Key provided by the client, which will be modified in place to the result string (Sec-WebSocket-Accept).
Returns
Reference to the modified str.
Note
The implementation refers to the handshake process in Section 4.2.2 of RFC 6455.

The documentation for this class was generated from the following file: