AudioWebSocket Main low level API to communicate with the audio streaming socket of VoxtaServer.
More...
#include <AudioWebSocket.h>
|
| AudioWebSocket (const FString &serverIP, uint16 serverPort) |
| Register the address and port the socket should use to connect with VoxtaServer.
|
|
| ~AudioWebSocket () |
|
bool | Connect (const FGuid &sessionId) |
| Create the websocket through FWebSocketsModule and start up the connection.
|
|
void | Close (int code=1000, const FString &reason=FString()) |
| Manually close the websocket connection.
|
|
void | Send (const void *buffer, unsigned int nBufferBytes) |
| Send binary data through the websocket.
|
|
void | Send (const FString &message) |
| Send string data through the websocket.
|
|
|
IWebSocket::FWebSocketConnectedEvent | OnConnectedEvent |
| Called when a web socket connection has been established successfully.
|
|
IWebSocket::FWebSocketConnectionErrorEvent | OnConnectionErrorEvent |
| Called when a web socket connection could not be established.
|
|
IWebSocket::FWebSocketClosedEvent | OnClosedEvent |
| Called when a web socket connection has been closed.
|
|
AudioWebSocket Main low level API to communicate with the audio streaming socket of VoxtaServer.
Internally relies on Unreal's FWebSocketsModule implementation.
Note: This class is not thread-safe. All methods should be called from the same thread.
◆ AudioWebSocket()
AudioWebSocket::AudioWebSocket |
( |
const FString & | serverIP, |
|
|
uint16 | serverPort ) |
Register the address and port the socket should use to connect with VoxtaServer.
- Parameters
-
serverIP | The VoxtaServer host IP address. (ipv4) |
serverPort | The VoxtaServer host port. |
◆ ~AudioWebSocket()
AudioWebSocket::~AudioWebSocket |
( |
| ) |
|
◆ Close()
void AudioWebSocket::Close |
( |
int | code = 1000, |
|
|
const FString & | reason = FString() ) |
Manually close the websocket connection.
- Parameters
-
◆ Connect()
bool AudioWebSocket::Connect |
( |
const FGuid & | sessionId | ) |
|
Create the websocket through FWebSocketsModule and start up the connection.
Call this after setting up event handlers or to reconnect after connection errors.
- Parameters
-
sessionId | The sessionId that we want to forward our audio to. |
- Returns
- False if we failed to create the websocket instance.
◆ Send() [1/2]
void AudioWebSocket::Send |
( |
const FString & | message | ) |
|
Send string data through the websocket.
- Parameters
-
message | Data to be sent as a UTF-8 encoded string. |
◆ Send() [2/2]
void AudioWebSocket::Send |
( |
const void * | buffer, |
|
|
unsigned int | nBufferBytes ) |
Send binary data through the websocket.
- Parameters
-
buffer | A pointer to the first byte of the data to be sent. |
nBufferBytes | Number of bytes to send. |
◆ OnClosedEvent
IWebSocket::FWebSocketClosedEvent AudioWebSocket::OnClosedEvent |
Called when a web socket connection has been closed.
◆ OnConnectedEvent
IWebSocket::FWebSocketConnectedEvent AudioWebSocket::OnConnectedEvent |
Called when a web socket connection has been established successfully.
◆ OnConnectionErrorEvent
IWebSocket::FWebSocketConnectionErrorEvent AudioWebSocket::OnConnectionErrorEvent |
Called when a web socket connection could not be established.
The documentation for this class was generated from the following files: