NetworkWebSocketServerInterface Class Reference

#include <network_websocket.h>

Inheritance diagram for NetworkWebSocketServerInterface:

公共成员函数

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")

成员函数文档编制

◆  MAXON_INTERFACE()

MAXON_INTERFACE ( NetworkWebSocketServerInterface   ,
MAXON_REFERENCE_NORMAL   ,
"net.maxon.interface.networkwebsocketserver"   
)
private

◆  StartWebServer()

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.
返回
OK on success.

◆  StopWebServer()

MAXON_METHOD Result <void> StopWebServer ( )

Stops the web server and closes all connections.

返回
OK on success.

◆  AttachToWebServer()

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.
返回
OK on success.

◆  GetWebServer()

const MAXON_METHOD NetworkWebServerRef& GetWebServer ( )

Returns the web server connected to this object.

返回
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.

参数
[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.
返回
OK on success.