#include <network_websocket.h>
公共成员函数 |
|
| MAXON_METHOD Result < void > | StartWebServer (const NetworkIpAddrPort &addressAndPort, Bool waitForListener, const String &requestedProtocol) |
| MAXON_METHOD Result < void > | StopWebServer () |
| MAXON_METHOD Result < void > | AttachToWebServer (const NetworkWebServerRef &webServer, const String &requestedProtocol) |
| const MAXON_METHOD NetworkWebServerRef & | GetWebServer () |
| MAXON_METHOD Result < void > | HandleHandShake (const NetworkWebSocketConnectionRef &webSocket, const DataDictionary &request, const String &requestedProtocol) |
私有成员函数 |
|
| MAXON_INTERFACE ( NetworkWebSocketServerInterface , MAXON_REFERENCE_NORMAL , "net.maxon.interface.networkwebsocketserver") | |
|
private |
| MAXON_METHOD Result <void> StartWebServer | ( | const NetworkIpAddrPort & | addressAndPort , |
| Bool | waitForListener , | ||
| const String & | requestedProtocol | ||
| ) |
Start a new web server using given port.
| [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. |
| MAXON_METHOD Result <void> StopWebServer | ( | ) |
Stops the web server and closes all connections.
| MAXON_METHOD Result <void> AttachToWebServer | ( | const NetworkWebServerRef & | webServer , |
| const String & | requestedProtocol | ||
| ) |
Attaches the WebSocket to a running web server.
| [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. |
| const MAXON_METHOD NetworkWebServerRef& GetWebServer | ( | ) |
Returns the web server connected to this object.
| MAXON_METHOD Result <void> HandleHandShake | ( | const NetworkWebSocketConnectionRef & | webSocket , |
| const DataDictionary & | request , | ||
| const String & | requestedProtocol | ||
| ) |
Handles the client handshake.
| [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. |