Public Member Functions | Static Public Member Functions | List of all members
Server Class Reference

A WebSocket server. More...

#include <cvb/webstreaming/server.hpp>

Public Member Functions

int ActiveConnections () const
 Get the number of active connections. More...
 
void SendSync (const Image &image)
 Sends an image synchronously. More...
 
void SendAsync (const Image &image)
 Sends an image asynchronously. More...
 
void * Handle () const noexcept
 Returns C-API style handle to Server Object. More...
 
String IPAddress () const noexcept
 Get the IP address of the server. More...
 
int Port () const noexcept
 Get destination port. More...
 

Static Public Member Functions

static ServerPtr Create (const String &ipAddress, int port, const ConverterPtr &converter)
 Creates a WebSocket server with given converter. More...
 
static ServerPtr Create (const String &ipAddress, int port)
 Creates a WebSocket server. More...
 

Detailed Description

A WebSocket server.

Server for sending image data.

Member Function Documentation

◆ ActiveConnections()

int ActiveConnections ( ) const
inline

Get the number of active connections.

Returns
Number of active connections.
Exceptions
Anyexception derived from std::exception including CvbException.

◆ Create() [1/2]

static ServerPtr Create ( const String ipAddress,
int  port,
const ConverterPtr converter 
)
inlinestatic

Creates a WebSocket server with given converter.

Parameters
[in]ipAddressThe IP-Address for the server. Example: 169.254.0.1.
[in]portThe port for the server. Example: 1112.
[in]converterThe converter to use.
Returns
A pointer to a server object.
Exceptions
Anyexception derived from std::exception including CvbException.

Images are converted according to the given converter before sending.

◆ Create() [2/2]

static ServerPtr Create ( const String ipAddress,
int  port 
)
inlinestatic

Creates a WebSocket server.

Parameters
[in]ipAddressThe IP-Address for the server. Example: 169.254.0.1.
[in]portThe port for the server. Example: 1112
Returns
A pointer to a server object.
Exceptions
Anyexception derived from std::exception including CvbException.

Images are not converted before sending (raw).

◆ Handle()

void* Handle ( ) const
inlinenoexcept

Returns C-API style handle to Server Object.

Returns
C-API handle
Exceptions
Doesnot throw any exception.

◆ IPAddress()

String IPAddress ( ) const
inlinenoexcept

Get the IP address of the server.

Returns
The IP address.
Exceptions
Doesnot throw any exception.

◆ Port()

int Port ( ) const
inlinenoexcept

Get destination port.

Returns
The port.
Exceptions
Doesnot throw any exception.

◆ SendAsync()

void SendAsync ( const Image image)
inline

Sends an image asynchronously.

Parameters
[in]imageThe image to send.
Exceptions
Anyexception derived from std::exception including CvbException.

The image will be copied/converted and put on a queue. After that the function will return immediately.

◆ SendSync()

void SendSync ( const Image image)
inline

Sends an image synchronously.

Parameters
[in]imageThe image to send.
Exceptions
Anyexception derived from std::exception including CvbException.

The image will be copied/converted and put on a queue. Once the image was sent the method will return.