DataChannelServer
A C++ library for creating WebRTC DataChannel servers.
|
A class which represents a single peer connection. More...
Public Member Functions | |
DataChannel (const DataChannel &other)=delete | |
DataChannel & | operator= (const DataChannel &)=delete |
~DataChannel () | |
Closes the channel. | |
void | SendMessage (const std::string &message) |
Send a message to the other side. More... | |
void | SetOnMessageHandler (std::function< void(const std::string &message)> handler) |
Set a handler for processing new messages. More... | |
void | SetOnCloseHandler (std::function< void()> handler) |
Get a notification when the channel is closed. More... | |
A class which represents a single peer connection.
When this class is destroyed, the connection is closed. You can also set on message and on close handlers. As well as directly send messages.
|
inline |
Send a message to the other side.
message | The provided message. |
|
inline |
Get a notification when the channel is closed.
NOTE: You cannot call SendMessage() after receiving a CloseMessage. You should also free the DataChannel to avoid memory leaks after receiving a close.
handler | The callback for when the channel is closed. |
|
inline |
Set a handler for processing new messages.
handler | The callback when a new message arrives. |