|
Twitch SDK (Internal)
|
#include <socket.h>
Public Types | |
| enum | MessageType { MessageType::None, MessageType::Binary, MessageType::Text, MessageType::Unknown } |
Public Member Functions | |
| virtual | ~IWebSocket ()=default |
| virtual TTV_ErrorCode | Connect ()=0 |
| virtual TTV_ErrorCode | Disconnect ()=0 |
| virtual TTV_ErrorCode | Send (MessageType type, const uint8_t *buffer, size_t length)=0 |
| virtual TTV_ErrorCode | Recv (MessageType &type, uint8_t *buffer, size_t length, size_t &received)=0 |
| virtual TTV_ErrorCode | Peek (MessageType &type, size_t &length)=0 |
| virtual bool | Connected ()=0 |
This interface provides generic, synchronous access to a web socket (ws protocol). An instance of IWebSocket is generally bound to a single endpoint. The connection can be opened and closed as many times as desired but it can't be changed to point to another peer.
|
strong |
|
virtualdefault |
Destructor.
|
pure virtual |
Synchronously connects to the endpoint.
Implemented in ttv::binding::java::JavaWebSocket, and ttv::StandardWebSocket.
|
pure virtual |
Determines if the socket is currently connected.
Implemented in ttv::binding::java::JavaWebSocket, and ttv::StandardWebSocket.
|
pure virtual |
Synchronously disconnects from the endpoint.
Implemented in ttv::binding::java::JavaWebSocket, and ttv::StandardWebSocket.
|
pure virtual |
Determines the size and type of the next available message. If no messages are available then a message type of None will be returned.
| [out] | type | The buffer to store the received bytes in. |
| [out] | length | The number of bytes actually received. |
Implemented in ttv::binding::java::JavaWebSocket, and ttv::StandardWebSocket.
|
pure virtual |
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.
| [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. |
Implemented in ttv::binding::java::JavaWebSocket, and ttv::StandardWebSocket.
|
pure virtual |
Sends a message of the given type.
| [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. |
Implemented in ttv::binding::java::JavaWebSocket, and ttv::StandardWebSocket.
1.8.13