#include <network_websocket.h>
◆ MAXON_INTERFACE()
◆ StartWebServer()
Start a new web server using given port.
- Parameters
-
[in] | addressAndPort | Address and port which should be listened on. |
[in] | waitForListener | If true the functions waits until the listener is open. Otherwise it returns immediately. |
[in] | requestedProtocol | Given protocol to check within the handshake. The requestedProtocol will be compared to the "sec-websocket-protocol" property of the http incoming header. |
- Returns
- OK on success.
◆ StopWebServer()
Stops the web server and closes all connections.
- Returns
- OK on success.
◆ AttachToWebServer()
Attaches the WebSocket to a running web server.
- Parameters
-
[in] | webServer | Reference to a WebServerRef object. |
[in] | requestedProtocol | Given protocol to check within the handshake. The requestedProtocol will be compared to the "sec-websocket-protocol" property of the http incoming header. |
- Returns
- OK on success.
◆ GetWebServer()
Returns the web server connected to this object.
- Returns
- Returns the web server connected to this object.
◆ HandleHandShake()
MAXON_METHOD Result<void> HandleHandShake |
( |
const NetworkWebSocketConnectionRef & |
webSocket, |
|
|
const DataDictionary & |
request, |
|
|
const String & |
requestedProtocol |
|
) |
| |
Handles the client handshake.
- Parameters
-
[in] | webSocket | Socket connection to use for the handshake. |
[in] | request | The web server request. |
[in] | requestedProtocol | Optional parameter to check if a protocol is supported by the server. If the protocol is not found in the header the function fails. |
- Returns
- OK on success.