WebSocket HTTP server helper.
More...
#include <wpinet/WebSocketServer.h>
WebSocket HTTP server helper.
Handles websocket-specific headers. User must provide the HttpParser.
◆ WebSocketServerHelper()
wpi::WebSocketServerHelper::WebSocketServerHelper |
( |
HttpParser & |
req | ) |
|
|
explicit |
◆ Accept()
Accept the upgrade.
Disconnect other readers (such as the HttpParser reader) before calling this. See also WebSocket::CreateServer().
- Parameters
-
stream | Connection stream |
protocol | The subprotocol to send to the client |
◆ IsUpgrade()
bool wpi::WebSocketServerHelper::IsUpgrade |
( |
| ) |
const |
|
inline |
◆ IsWebsocket()
bool wpi::WebSocketServerHelper::IsWebsocket |
( |
| ) |
const |
|
inline |
Get whether or not this was a websocket upgrade.
Only valid during and after the upgrade event.
◆ MatchProtocol() [1/2]
Try to find a match to the list of sub-protocols provided by the client.
The list is priority ordered, so the first match wins. Only valid during and after the upgrade event.
- Parameters
-
protocols | Acceptable protocols |
- Returns
- Pair; first item is true if a match was made, false if not. Second item is the matched protocol if a match was made, otherwise is empty.
◆ MatchProtocol() [2/2]
Try to find a match to the list of sub-protocols provided by the client.
The list is priority ordered, so the first match wins. Only valid during and after the upgrade event.
- Parameters
-
protocols | Acceptable protocols |
- Returns
- Pair; first item is true if a match was made, false if not. Second item is the matched protocol if a match was made, otherwise is empty.
◆ upgrade
Upgrade event.
Call Accept() to accept the upgrade.
The documentation for this class was generated from the following file: