CFx SDK Documentation
2020SP3
|
#include <FxNAWebSocket.h>
Public Types | |
enum | SocketState { UnconnectedState, HostLookupState, ConnectingState, ConnectedState, BoundState, ListeningState, ClosingState } |
Additional Inherited Members | |
Protected Member Functions inherited from CFxUIObject | |
CFxUIObject * | sender () |
Protected Attributes inherited from CFxUIObject | |
CFxUIObjectImpl * | m_pImpl |
CFxUIObjectData * | m_pData |
Class CFxNAWebSocket Implements a TCP socket that talks the WebSocket protocol.
Definition at line 33 of file FxNAWebSocket.h.
Enumerator | |
---|---|
UnconnectedState | |
HostLookupState | |
ConnectingState | |
ConnectedState | |
BoundState | |
ListeningState | |
ClosingState |
Definition at line 36 of file FxNAWebSocket.h.
|
explicit |
Constructor
Creates a new CFxNAWebSocket with the given origin, the version of the protocol to use.
origin | Input |
version | Input |
CFxNAWebSocket::~CFxNAWebSocket | ( | ) |
Destructor
void CFxNAWebSocket::close | ( | CFxNAWebSocketProtocol::CloseCode | closeCode = CFxNAWebSocketProtocol::CloseCodeNormal , |
const CFxNAString & | reason = CFxNAString() |
||
) |
Gracefully closes the socket with the given closeCode and reason.
closeCode | Input |
reason | Input |
CFxUISignal< void( void ) >& CFxNAWebSocket::connected | ( | ) |
Signal is emitted when a connection is successfully established. A connection is successfully established when the socket is connected and the handshake was successful.
CFxUISignal< void( void ) >& CFxNAWebSocket::disconnected | ( | ) |
Signal is emitted when the socket is disconnected.
CFxUISignal< void( int ) >& CFxNAWebSocket::error | ( | ) |
Signal is emitted after an error occurred. The error parameter describes the type of error that occurred.
void CFxNAWebSocket::open | ( | const CFxNANetworkRequest & | request | ) |
Opens a WebSocket connection using the given request.
request | Input |
long long CFxNAWebSocket::sendTextMessage | ( | const CFxUIString & | textMessage | ) |
Sends a text message through the open socket.
textMessage | Text message |
CFxUISignal< void( const CFxNAString & ) >& CFxNAWebSocket::textMessageReceived | ( | ) |
Signal is emitted whenever a text message is received. The message contains the received text.