#include <standardwebsocket.h>
◆ MessageType
The type of data in a frame.
| Enumerator |
|---|
| None | No data.
|
| Binary | A binary frame.
|
| Text | A text frame.
|
| Unknown | An unknown/unhandled frame type.
|
◆ StandardWebSocket()
| ttv::StandardWebSocket::StandardWebSocket |
( |
| ) |
|
◆ ~StandardWebSocket()
| virtual ttv::StandardWebSocket::~StandardWebSocket |
( |
| ) |
|
|
virtual |
◆ Connect()
Synchronously connects to the endpoint.
- See also
- Disconnect
- Returns
- TTV_EC_SUCCESS: The socket has successfully connected and is ready to exchange data.
- TTV_EC_SOCKET_EALREADY: Already connected.
- TTV_EC_SOCKET_ETIMEDOUT: The connection timed out.
- TTV_EC_SOCKET_ERR: A generic error occurred.
Implements ttv::IWebSocket.
◆ Connected()
| virtual bool ttv::StandardWebSocket::Connected |
( |
| ) |
|
|
overridevirtual |
Determines if the socket is currently connected.
- Returns
- Whether or not currently connected.
Implements ttv::IWebSocket.
◆ Disconnect()
Synchronously disconnects from the endpoint.
- See also
- Connect
- Returns
- TTV_EC_SUCCESS: The socket has successfully disconnected.
- TTV_EC_SOCKET_ERR: A generic error occurred.
Implements ttv::IWebSocket.
◆ Initialize()
| TTV_ErrorCode ttv::StandardWebSocket::Initialize |
( |
const std::string & |
uri | ) |
|
◆ Peek()
Determines the size and type of the next available message. If no messages are available then a message type of None will be returned.
- See also
- Recv
- Parameters
-
| [out] | type | The buffer to store the received bytes in. |
| [out] | length | The number of bytes actually received. |
- Returns
- TTV_EC_SUCCESS: Some bytes have been received.
- TTV_EC_SOCKET_ENOTCONN: The socket is not connected.
- TTV_EC_SOCKET_ECONNABORTED: The connected was dropped.
- TTV_EC_SOCKET_ETIMEDOUT: The connection timed out.
- TTV_EC_SOCKET_ECONNRESET: The connection was closed by the remote host.
- TTV_EC_SOCKET_ERR: A generic error occurred.
Implements ttv::IWebSocket.
◆ PollBaseSocket()
◆ Recv()
| virtual TTV_ErrorCode ttv::StandardWebSocket::Recv |
( |
MessageType & |
type, |
|
|
uint8_t * |
buffer, |
|
|
size_t |
length, |
|
|
size_t & |
received |
|
) |
| |
|
overridevirtual |
Attempts to receive a message from the web socket. The next available message will be stored in buffer provided that it is large enough to store it. Use Peek() to determine how large of a buffer to provide. If the buffer is not large enough to hold the message then an error is returned and the message is not consumed.
- See also
- Peek
- Parameters
-
| [out] | type | The buffer to store the received bytes in. |
| [in] | buffer | The buffer to store the received bytes in. |
| [in] | length | The largest number of bytes to receive. |
| [out] | received | The number of bytes actually received. |
- Returns
- TTV_EC_SUCCESS: Some bytes have been received.
- TTV_EC_SOCKET_ENOTCONN: The socket is not connected.
- TTV_EC_SOCKET_ECONNABORTED: The connected was dropped.
- TTV_EC_SOCKET_ETIMEDOUT: The connection timed out.
- TTV_EC_SOCKET_ECONNRESET: The connection was closed by the remote host.
- TTV_EC_SOCKET_ERR: A generic error occurred.
- TTV_EC_INVALID_BUFFER: The given buffer is not big enough to store the next message.
Implements ttv::IWebSocket.
◆ Send()
Sends a message of the given type.
- Parameters
-
| [in] | type | The type of data represented by the buffer. |
| [in] | buffer | The data to send. |
| [in] | length | The number of bytes in the buffer. |
- Returns
- TTV_EC_SUCCESS: The socket has successfully connected and is ready to exchange data.
- TTV_EC_SUCCESS: The message has been sent.
- TTV_EC_SOCKET_ENOTCONN: The socket is not connected.
- TTV_EC_SOCKET_ECONNABORTED: The connected was dropped.
- TTV_EC_SOCKET_ETIMEDOUT: The connection timed out.
- TTV_EC_SOCKET_ECONNRESET: The connection was closed by the remote host.
- TTV_EC_SOCKET_ERR: A generic error occurred.
Implements ttv::IWebSocket.
◆ mInnerData
| std::unique_ptr<SocketData> ttv::StandardWebSocket::mInnerData |
|
private |
The documentation for this class was generated from the following file: