![]() |
Intel® Collaboration Suite for WebRTC
version 4.3.1
Open WebRTC Toolkit (OWT) Client SDK for Windows*
|
An async client for P2P WebRTC sessions. More...
#include <owt/p2p/p2pclient.h>
Public Member Functions | |
P2PClient (P2PClientConfiguration &configuration, std::shared_ptr< P2PSignalingChannelInterface > signaling_channel) | |
Init a P2PClient instance with speficied signaling channel. More... | |
void | AddObserver (P2PClientObserver &observer) |
void | RemoveObserver (P2PClientObserver &observer) |
void | Connect (const std::string &host, const std::string &token, std::function< void(const std::string &)> on_success, std::function< void(std::unique_ptr< Exception >)> on_failure) |
Connect to the signaling server. More... | |
void | Disconnect (std::function< void()> on_success, std::function< void(std::unique_ptr< Exception >)> on_failure) |
Disconnect from the signaling server. It will stop all active WebRTC sessions. More... | |
void | AddAllowedRemoteId (const std::string &target_id) |
Add a remote user to the allowed list to start a WebRTC session. More... | |
void | RemoveAllowedRemoteId (const std::string &target_id, std::function< void()> on_success, std::function< void(std::unique_ptr< Exception >)> on_failure) |
Remove a remote user from the allowed list to stop a WebRTC session. More... | |
void | Stop (const std::string &target_id, std::function< void()> on_success, std::function< void(std::unique_ptr< Exception >)> on_failure) |
Stop a WebRTC session. More... | |
void | Publish (const std::string &target_id, std::shared_ptr< owt::base::LocalStream > stream, std::function< void(std::shared_ptr< P2PPublication >)> on_success, std::function< void(std::unique_ptr< Exception >)> on_failure) |
Publish a stream to the remote client. More... | |
void | Send (const std::string &target_id, const std::string &message, std::function< void()> on_success, std::function< void(std::unique_ptr< Exception >)> on_failure) |
Send a message to remote client. More... | |
void | GetConnectionStats (const std::string &target_id, std::function< void(std::shared_ptr< owt::base::ConnectionStats >)> on_success, std::function< void(std::unique_ptr< Exception >)> on_failure) |
Get the connection statistowt with target client. More... | |
An async client for P2P WebRTC sessions.
owt::p2p::P2PClient::P2PClient | ( | P2PClientConfiguration & | configuration, |
std::shared_ptr< P2PSignalingChannelInterface > | signaling_channel | ||
) |
void owt::p2p::P2PClient::AddAllowedRemoteId | ( | const std::string & | target_id | ) |
Add a remote user to the allowed list to start a WebRTC session.
target_id | Remote user's ID. |
void owt::p2p::P2PClient::AddObserver | ( | P2PClientObserver & | observer | ) |
Add an observer for peer client.
observer | Add this object to observer list. Do not delete this object until it is removed from observer list. |
void owt::p2p::P2PClient::Connect | ( | const std::string & | host, |
const std::string & | token, | ||
std::function< void(const std::string &)> | on_success, | ||
std::function< void(std::unique_ptr< Exception >)> | on_failure | ||
) |
Connect to the signaling server.
host | The URL of signaling server to connect |
token | A token used for connection and authentication |
on_success | Sucess callback will be invoked with current user's ID if connect to server successfully. |
on_failure | Failure callback will be invoked if one of these cases happened:
|
void owt::p2p::P2PClient::Disconnect | ( | std::function< void()> | on_success, |
std::function< void(std::unique_ptr< Exception >)> | on_failure | ||
) |
Disconnect from the signaling server. It will stop all active WebRTC sessions.
on_success | Sucess callback will be invoked if disconnect from server successfully. |
on_failure | Failure callback will be invoked if one of these cases happened:
|
void owt::p2p::P2PClient::GetConnectionStats | ( | const std::string & | target_id, |
std::function< void(std::shared_ptr< owt::base::ConnectionStats >)> | on_success, | ||
std::function< void(std::unique_ptr< Exception >)> | on_failure | ||
) |
Get the connection statistowt with target client.
target_id | Remote user's ID. |
on_success | Success callback will be invoked if get statistoms information successes. |
on_failure | Failure callback will be invoked if one of the following cases happened.
|
void owt::p2p::P2PClient::Publish | ( | const std::string & | target_id, |
std::shared_ptr< owt::base::LocalStream > | stream, | ||
std::function< void(std::shared_ptr< P2PPublication >)> | on_success, | ||
std::function< void(std::unique_ptr< Exception >)> | on_failure | ||
) |
Publish a stream to the remote client.
stream | The stream which will be published. |
target_id | Target user's ID. |
on_success | Success callback will be invoked it the stream is published. |
on_failure | Failure callback will be invoked if one of these cases happened:
|
void owt::p2p::P2PClient::RemoveAllowedRemoteId | ( | const std::string & | target_id, |
std::function< void()> | on_success, | ||
std::function< void(std::unique_ptr< Exception >)> | on_failure | ||
) |
Remove a remote user from the allowed list to stop a WebRTC session.
target_id | Remote user's ID. |
on_success | Success callback will be invoked if removing a remote user successfully. |
on_failure | Failure callback will be invoked if one of the following cases happened.
|
void owt::p2p::P2PClient::RemoveObserver | ( | P2PClientObserver & | observer | ) |
Remove an observer from peer client.
observer | Remove this object from observer list. |
void owt::p2p::P2PClient::Send | ( | const std::string & | target_id, |
const std::string & | message, | ||
std::function< void()> | on_success, | ||
std::function< void(std::unique_ptr< Exception >)> | on_failure | ||
) |
Send a message to remote client.
target_id | Remote user's ID. |
message | The message to be sent. |
on_success | Success callback will be invoked if message sent successfully. |
on_failure | Failure callback will be invoked if one of the following cases happened.
|
void owt::p2p::P2PClient::Stop | ( | const std::string & | target_id, |
std::function< void()> | on_success, | ||
std::function< void(std::unique_ptr< Exception >)> | on_failure | ||
) |
Stop a WebRTC session.
target_id | Remote user's ID. |
target_id | Success callback will be invoked if send stop event successfully. |
on_failure | Failure callback will be invoked if one of the following cases happened.
|