DataChannelServer
A C++ library for creating WebRTC DataChannel servers.
|
A DataChannel server. More...
Public Member Functions | |
Server (int port, DataChannelSettings settings=DataChannelSettings()) | |
Create the server listening on a certain port. More... | |
void | SetConnectionHandler (std::function< void(std::shared_ptr< DataChannel >)> handler) |
Get notified whenever there is a connection. More... | |
void | Start () |
Run the server. More... | |
void | Stop () |
Stop the server. More... | |
A DataChannel server.
Example usage:
|
inline |
Create the server listening on a certain port.
You can also specify the settings for the created DataChannels. By default, it will create reliable, ordered channels.
port | The port the server will be listening on. |
settings | The settings for the created DataChannels. |
|
inline |
Get notified whenever there is a connection.
The user ownes the resulting DataChannel and it gets closed when the provided shared_ptr becomes freed.
handler | The callback to be used whenever there is a new connection. |
|
inline |
Run the server.
This will block and run the internal io_service until Stop is called.
|
inline |
Stop the server.
Stops listening on the socket.