Open Search
    NetworkWebSocketServerInterface Class Reference

    #include <network_websocket.h>

    Inheritance diagram for NetworkWebSocketServerInterface:

    Public Member Functions

    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)
     
    MAXON_METHOD const NetworkWebServerRef & GetWebServer ()
     
    MAXON_METHOD Result< void > HandleHandShake (const NetworkWebSocketConnectionRef &webSocket, const DataDictionary &request, const String &requestedProtocol)
     

    Private Member Functions

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

    Member Function Documentation

    ◆ 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.

    Parameters
    [in]addressAndPortAddress and port which should be listened on.
    [in]waitForListenerIf true the functions waits until the listener is open. Otherwise it returns immediately.
    [in]requestedProtocolGiven 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()

    MAXON_METHOD Result<void> StopWebServer ( )

    Stops the web server and closes all connections.

    Returns
    OK on success.

    ◆ AttachToWebServer()

    MAXON_METHOD Result<void> AttachToWebServer ( const NetworkWebServerRef &  webServer,
    const String requestedProtocol 
    )

    Attaches the WebSocket to a running web server.

    Parameters
    [in]webServerReference to a WebServerRef object.
    [in]requestedProtocolGiven 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()

    MAXON_METHOD const NetworkWebServerRef& 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]webSocketSocket connection to use for the handshake.
    [in]requestThe web server request.
    [in]requestedProtocolOptional 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.