NetworkWebSocketConnectionInterface Class Reference

#include <network_websocket.h>

Inheritance diagram for NetworkWebSocketConnectionInterface:

Detailed Description

Class that handles the WebSocket Protocol and an easy interface to use WebSockets.

Public Types

using RESTRICT_DICTIONARY_PROPS = NETWORKWEBSOCKETCONNECTIONPROPERTIES::RESTRICT
 

Public Member Functions

MAXON_METHOD Result< void > Init (const NetworkHttpHandlerRef &handler)
 
const MAXON_METHOD NetworkHttpHandlerRef & GetHandler () const
 
MAXON_METHOD Result< void > Close ()
 
MAXON_METHOD Result< void > Send (const Block< const Char > &buffer, WEBSOCKETTYPE type)
 
MAXON_METHOD Result< void > Send (const String &data, WEBSOCKETTYPE type=WEBSOCKETTYPE::TEXT)
 
MAXON_METHOD WEBSOCKETSTATE GetState () const
 

Private Member Functions

 MAXON_INTERFACE (NetworkWebSocketConnectionInterface, MAXON_REFERENCE_NORMAL, "net.maxon.interface.networkwebsocketconnection")
 

Member Typedef Documentation

◆ RESTRICT_DICTIONARY_PROPS

using RESTRICT_DICTIONARY_PROPS = NETWORKWEBSOCKETCONNECTIONPROPERTIES::RESTRICT

Member Function Documentation

◆ MAXON_INTERFACE()

MAXON_INTERFACE ( NetworkWebSocketConnectionInterface  ,
MAXON_REFERENCE_NORMAL  ,
"net.maxon.interface.networkwebsocketconnection"   
)
private

◆ Init()

MAXON_METHOD Result<void> Init ( const NetworkHttpHandlerRef &  handler)

◆ GetHandler()

const MAXON_METHOD NetworkHttpHandlerRef& GetHandler ( ) const

◆ Close()

MAXON_METHOD Result<void> Close ( )

Closes the WebSocket connection.

Returns
OK on success.

◆ Send() [1/2]

MAXON_METHOD Result<void> Send ( const Block< const Char > &  buffer,
WEBSOCKETTYPE  type 
)

Send bytes as WebProtocol message.

Parameters
[in]bufferBuffer data to send.
[in]typeDefines the type of the WebSocket frame to be send.
Returns
OK on success.

◆ Send() [2/2]

MAXON_METHOD Result<void> Send ( const String data,
WEBSOCKETTYPE  type = WEBSOCKETTYPE::TEXT 
)

Send String as WebProtocol message.

Parameters
[in]dataData to be send.
[in]typeType of the data to be send (see WEBSOCKETTYPE).
Returns
OK on success.

◆ GetState()

MAXON_METHOD WEBSOCKETSTATE GetState ( ) const

Returns the state of the connection.

Returns
Returns the state of the connection.