Protocol upgrade helper.
More...
VTM_API bool vtm_http_is_ws_request |
( |
struct vtm_http_req * |
req | ) |
|
Checks if the given request is a WebSocket handshake request.
- Parameters
-
req | the request that should be checked |
- Returns
- true if request is a WebSocket handshake request
-
false if not a handshake request
VTM_API void vtm_http_get_ws_protocols |
( |
struct vtm_http_req * |
req, |
|
|
char *** |
protos, |
|
|
size_t * |
proto_count |
|
) |
| |
Extracts the requested WebSocket protocols from the request.
- Parameters
-
| req | the request where the protocols should be extracted from |
[out] | protos | will be filled with array of pointers to protocol names |
[out] | proto_count | will be filled with the number of protocol names |
VTM_API int vtm_http_upgrade_to_ws |
( |
struct vtm_http_req * |
req, |
|
|
vtm_http_res * |
res, |
|
|
char * |
proto |
|
) |
| |
Prepares the response so that the connection is upgraded to WebSocket protocol afterwards.
- Parameters
-
req | the WebSocket handshake request |
res | the response that should be filled |
proto | the chosen WebSocket protocol, can be NULL |
- Returns
- VTM_OK if the response was successfully prepared
-
VTM_ERROR if an error occured