Intel® Collaboration Suite for WebRTC  version 4.3.1
Open WebRTC Toolkit (OWT) Client SDK for iOS*
OWTP2PClient Class Reference

An async client for P2P WebRTC sessions. More...

#import <OWTP2PClient.h>

Inheritance diagram for OWTP2PClient:
Collaboration diagram for OWTP2PClient:

Instance Methods

(instancetype) - initWithConfiguration:signalingChannel:
 Initialize a OWTP2PClient instance with a specific signaling channel. More...
 
(void) - connect:onSuccess:onFailure:
 Connect to the signaling server. More...
 
(void) - disconnectWithOnSuccess:onFailure:
 Disconnect from the signaling server. It will stop all active WebRTC sessions. More...
 
(void) - send:to:onSuccess:onFailure:
 Send a message to remote client. More...
 
(void) - stop:
 Stop a WebRTC session. More...
 
(void) - publish:to:onSuccess:onFailure:
 Publish a stream to the remote client. More...
 
(void) - statsFor:onSuccess:onFailure:
 Get the connection statistowt with target client. More...
 
- Instance Methods inherited from <OWTP2PSignalingChannelDelegate>
(void) - channel:didReceiveMessage:from:
 This function will be triggered when new message arrives. More...
 
(void) - channelDidDisconnect:
 This function will be triggered when disconnected from signaling server.
 

Properties

id< OWTP2PClientDelegatedelegate
 
NSMutableArray< NSString * > * allowedRemoteIds
 

Detailed Description

An async client for P2P WebRTC sessions.

Method Documentation

◆ connect:onSuccess:onFailure:()

- (void) connect: (NSString *)  token
onSuccess: (nullable void(^)(NSString *))  onSuccess
onFailure: (nullable void(^)(NSError *))  onFailure 

Connect to the signaling server.

Parameters
tokenA token used for connection and authentication
onSuccessSuccess callback will be invoked with current user's ID if connect to server successfully.
onFailureFailure callback will be invoked if one of these cases happened:
  1. OWTP2PClient is connecting or connected to a server.
  2. Invalid token.

◆ disconnectWithOnSuccess:onFailure:()

- (void) disconnectWithOnSuccess: (nullable void(^)())  onSuccess
onFailure: (nullable void(^)(NSError *))  onFailure 

Disconnect from the signaling server. It will stop all active WebRTC sessions.

Parameters
onSuccessSuccess callback will be invoked if disconnect from server successfully.
onFailureFailure callback will be invoked if one of these cases happened:
  1. OWTP2PClient haven't connected to a signaling server.

◆ initWithConfiguration:signalingChannel:()

- (instancetype) initWithConfiguration: (OWTP2PClientConfiguration *)  configuration
signalingChannel: (id< OWTP2PSignalingChannelProtocol >)  signalingChannel 

Initialize a OWTP2PClient instance with a specific signaling channel.

Parameters
configurationConfiguration for creating the OWTP2PClient.
signalingChannelSignaling channel used for exchange signaling messages.

◆ publish:to:onSuccess:onFailure:()

- (void) publish: (OWTLocalStream *)  stream
to: (NSString *)  targetId
onSuccess: (nullable void(^)(OWTP2PPublication *))  onSuccess
onFailure: (nullable void(^)(NSError *))  onFailure 

Publish a stream to the remote client.

Parameters
streamThe stream which will be published.
toTarget user's ID.
onSuccessSuccess callback will be invoked it the stream is published.
onFailureFailure callback will be invoked if one of these cases happened:
  1. OWTP2PClient is disconnected from server.
  2. Target ID is nil or user is offline.
  3. Haven't connected to remote client.

◆ send:to:onSuccess:onFailure:()

- (void) send: (NSString *)  message
to: (NSString *)  targetId
onSuccess: (nullable void(^)())  onSuccess
onFailure: (nullable void(^)(NSError *))  onFailure 

Send a message to remote client.

Parameters
messageThe message to be sent.
targetIdRemote user's ID.
onSuccessSuccess callback will be invoked if send deny event successfully.
onFailureFailure callback will be invoked if one of the following cases happened.
  1. OWTP2PClient is disconnected from the server.
  2. Target ID is nil or target user is offline.
  3. There is no WebRTC session with target user.

◆ statsFor:onSuccess:onFailure:()

- (void) statsFor: (NSString *)  targetId
onSuccess: (void(^)(NSArray< RTCLegacyStatsReport * > *))  onSuccess
onFailure: (nullable void(^)(NSError *))  onFailure 

Get the connection statistowt with target client.

Parameters
targetIdRemote user's ID.
onSuccessSuccess callback will be invoked if get statistoms information successes.
onFailureFailure callback will be invoked if one of the following cases happened.
  1. Target ID is invalid.
  2. There is no WebRTC session with target user.

◆ stop:()

- (void) stop: (NSString *)  targetId

Stop a WebRTC session.

Clean all resources associated with given remote endpoint. It may include RTCPeerConnection, RTCRtpTransceiver and RTCDataChannel. It still possible to publish a stream, or send a message to given remote endpoint after stop.

Parameters
targetIdRemote user's ID.