A peer class.
More...
#import <SKWPeer.h>
|
(nonnull NSString *) | + sdkVersion |
| Getting current SDK version.
|
|
|
NSString *__nullable | identity |
| The brokering ID of this peer. More...
|
|
NSDictionary *__nullable | connections |
| A object array of all connections this peer, keyed by the remote peer's ID.
|
|
BOOL | isDisconnected |
| false if there is an active connection to the PeerServer.
|
|
BOOL | isDestroyed |
| true if this peer and all of its connections can no longer be used.
|
|
◆ callWithId:stream:
Calls the remote peer specified by id and returns a media connection.
Be sure to listen on the error event in case the connection fails.
- Parameters
-
peerId | Remote peer ID |
stream | Video stream |
- Returns
- Media connection object
◆ callWithId:stream:options:
Calls the remote peer specified by id and returns a media connection.
Be sure to listen on the error event in case the connection fails.
- Parameters
-
peerId | Remote peer ID |
stream | Video stream |
options | Option seeting dictionary |
- Returns
- Media connection object
◆ connectWithId:
Connects to the remote peer specified by id and returns a data connection.
Be sure to listen on the error event in case the connection fails.
- Parameters
-
peerId | The brokering ID of the remote peer (their peer.id). |
- Returns
Data connection object
◆ connectWithId:options:
Connects to the remote peer specified by id and returns a data connection.
Be sure to listen on the error event in case the connection fails.
- Parameters
-
peerId | The brokering ID of the remote peer (their peer.id). |
options | Option setting dictionary |
- Returns
Data connection object
◆ destroy
Close the connection to the signaling server and the already connected mediaConnection and dataConnection.
- Returns
- Processing result
◆ disconnect
(deprecated) Close the connection to the signaling server.
In addition, the connected mediaConnection and dataConnection are continued.
- Deprecated:
- This method is now deprecated. Use [SKWPeer -destroy] instead.
◆ fetchPeerExistsWithPeerId:success:error:
- (void) fetchPeerExistsWithPeerId: |
|
(NSString *__nonnull) |
peerId |
success: |
|
(void(^)(BOOL)) |
successCallback |
error: |
|
(void(^)(NSString *__nonnull)) |
errorCallback |
|
|
| |
Fetch whether Peer specified by Peer ID exists from the signaling server.
NSString* peerId;
}
error:^(NSString* __nonnull message) {
}];
- Parameters
-
peerId | Specify the Peer ID of the Peer whose existence you want to check. |
success | Set the callback to be executed when the existence of the Peer is fetched. |
error | Set the callback to be executed when an error is occured. |
◆ initWithId:options:
- (instancetype __nullable) initWithId: |
|
(NSString *__nullable) |
peerId |
options: |
|
(SKWPeerOption *__nullable) |
options |
|
|
| |
A peer can connect to other peers and listen for connections.
NSString* curtomPeerId = @"my-peer-id";
options.
key =
@"{your-dev-key}";
options.
domain = @”{your-domain}”;
options.
debug = SKW_PEER_DEBUG_LEVEL_ALL_LOGS;
SKWPeer* peer = [[
SKWPeer alloc] initWithId:curtomPeerId options:options];
- Parameters
-
peerId | Other peers can connect to this peer using the provided ID. If no ID is given, one will be generated by the brokering server. |
options | Option seetings. |
- Returns
- PeerObjC object
◆ initWithOptions:
- (instancetype __nullable) initWithOptions: |
|
(SKWPeerOption *__nullable) |
options |
|
A peer can connect to other peers and listen for connections.
ID is retrieve from brokering server.
options.
key =
@"{your-dev-key}";
options.
domain = @”{your-domain}”;
options.
debug = SKW_PEER_DEBUG_LEVEL_ALL_LOGS;
- Parameters
-
- Returns
- PeerObjC object
◆ joinRoomWithName:options:
- (SKWRoom* __nullable) joinRoomWithName: |
|
(NSString *__nonnull) |
roomName |
options: |
|
(SKWRoomOption *__nonnull) |
option |
|
|
| |
Full mesh room example:
NSString* roomName = @"fullmesh_videochat_room";
option.stream = localStream;
SFU room example:
NSString* roomName = @"sfu_textchat_room";
- Parameters
-
roomName | Room name |
option | Room option |
- Returns
- Room object
◆ listAllPeers:
- (void) listAllPeers: |
|
(void(^)(NSArray *__nullable)) |
callback |
|
Listing peer ID.
for (NSString* strPeer in aryPeers) {
}
}];
- Parameters
-
◆ on:callback:
Set blocks for peer events.
(Block Literal Syntax)
[peer
on:SKW_PEER_EVENT_OPEN
callback:^(NSObject* obj) {
if (YES == [obj isKindOfClass:[NSString class]]) {
NSString* ownId = (NSString *)obj;
}
}];
[peer
on:SKW_PEER_EVENT_CONNECTION
callback:^(NSObject* obj) {
}];
[peer
on:SKW_PEER_EVENT_CALL
callback:^(NSObject* obj) {
}];
[peer
on:SKW_PEER_EVENT_CLOSE
callback:^(NSObject* obj) {
}];
[peer
on:SKW_PEER_EVENT_DISCONNECTED
callback:^(NSObject* obj) {
}];
[peer
on:SKW_PEER_EVENT_ERROR
callback:^(NSObject* obj) {
NSLog(@"%@", err);
}];
- Parameters
-
event | Event type |
callback | Callback block literal |
◆ reconnect
(deprecated) Reconnect to the signaling server.
Use the assigned Peer ID when reconnecting.
- Deprecated:
- This method is now deprecated. Recreate peer instance instead.
◆ updateCredential:
credential.
timestamp = [[NSDate date] timeIntervalSince1970];
credential.
authToken =
@"calculated auth token";
- Parameters
-
newCredential | new credential |
◆ identity
- (NSString* __nullable) identity |
|
readnonatomicassign |
The brokering ID of this peer.
If no ID was specified in the constructor, this will be undefined until the open event is emitted.
NSUInteger ttl
Time to live; The credential expires at timestamp + ttl.
Definition: SKWPeerCredential.h:24
SKWMediaConnection *__nullable callWithId:stream:options:(NSString *__nonnull peerId,[stream] SKWMediaStream *__nullable stream,[options] SKWCallOption *__nullable options)
Calls the remote peer specified by id and returns a media connection.
Alternative class as DataConnection.
Definition: SKWDataConnection.h:41
BOOL destroy()
Close the connection to the signaling server and the already connected mediaConnection and dataConnec...
void on:callback:(SKWPeerEventEnum event,[callback] SKWPeerEventCallback __nullable callback)
Set blocks for peer events.
BOOL tryReconnectData
Set the value to YES to try to reconnect automatically when the data connection is lost.
Definition: SKWPeerOption.h:125
Error information class.
Definition: SKWPeerError.h:76
NSString *__nullable key
API key for the cloud PeerServer.
Definition: SKWPeerOption.h:63
A peer class.
Definition: SKWPeer.h:106
Media stream.
Definition: SKWMediaStream.h:18
The credential used to authenticate peer.
Definition: SKWPeerCredential.h:14
SKWDataConnection *__nullable connectWithId:(NSString *__nonnull peerId)
Connects to the remote peer specified by id and returns a data connection.
Alternative class as MediaConnection.
Definition: SKWMediaConnection.h:52
void fetchPeerExistsWithPeerId:success:error:(NSString *__nonnull peerId,[success] void(^ __nonnull successCallback)(BOOL),[error] void(^ __nullable errorCallback)(NSString *__nonnull))
Fetch whether Peer specified by Peer ID exists from the signaling server.
NSString *__nullable domain
Domain related to the SkyWay API Key.
Definition: SKWPeerOption.h:98
NSUInteger timestamp
Current UNIX timestamp.
Definition: SKWPeerCredential.h:19
@ SKW_ROOM_MODE_MESH
Fullmesh type room.
Definition: SKWRoomOption.h:21
NSString *__nullable metadata
Any type of metadata associated with the connection, passed in by whoever initiated the connection.
Definition: SKWCallOption.h:23
SKWDebugLevelEnum debug
Prints log messages depending on the debug level passed in.
Definition: SKWPeerOption.h:93
NSString *__nullable label
Label to easily identify the connection on either peer.
Definition: SKWConnectOption.h:19
BOOL tryReconnectMedia
Set the value to YES to try to reconnect automatically when the SKWMediaConnection with the other sid...
Definition: SKWPeerOption.h:120
BOOL turn
Using SkyWay TURN server.
Definition: SKWPeerOption.h:103
SKWDataConnection *__nullable connectWithId:options:(NSString *__nonnull peerId,[options] SKWConnectOption *__nullable options)
Connects to the remote peer specified by id and returns a data connection.
SKWPeer connect options.
Definition: SKWConnectOption.h:14
NSString * authToken
Credential token calculated with HMAC.
Definition: SKWPeerCredential.h:29
@ SKW_ROOM_MODE_SFU
SFU type room.
Definition: SKWRoomOption.h:25
SKWMediaConnection *__nullable callWithId:stream:(NSString *__nonnull peerId,[stream] SKWMediaStream *__nullable stream)
Calls the remote peer specified by id and returns a media connection.
NSString *__nullable metadata
Any type of metadata associated with the connection, passed in by whoever initiated the connection.
Definition: SKWConnectOption.h:27
SFU room class.
Definition: SKWSFURoom.h:24
SKWPeer call options.
Definition: SKWCallOption.h:14
SKWPeer initialize option class.
Definition: SKWPeerOption.h:53
void listAllPeers:(void(^ __nullable callback)(NSArray *__nullable))
Listing peer ID.
SKWRoomModeEnum mode
Room Mode.
Definition: SKWRoomOption.h:36
void updateCredential:(SKWPeerCredential *__nonnull newCredential)
Mesh room class.
Definition: SKWMeshRoom.h:22
Room Options.
Definition: SKWRoomOption.h:31
SKWSerializationEnum serialization
The serialization format of the data sent over the connection.
Definition: SKWConnectOption.h:32
@ SKW_SERIALIZATION_NONE
NONE.
Definition: SKWConnection.h:26