iOS SDK API Reference

SKWPeer.h
Go to the documentation of this file.
1 // SKWPeer.h
3 // SkyWay SDK
5 #import "SKWHeaders.h"
6 
11 #ifndef DOXYGEN_SKIP_THIS
12 extern NSString* __nonnull const kSKWTrue;
15 extern NSString* __nonnull const kSKWFalse;
16 
20 extern NSString* __nonnull const kSKWConnectionTypeData;
23 extern NSString* __nonnull const kSKWConnectionTypeMedia;
24 
28 extern NSString* __nonnull const kSKWPeerSerializationBinary;
31 extern NSString* __nonnull const kSKWPeerSerializationBinaryUtf8;
33 extern NSString* __nonnull const kSKWPeerSerializationJson;
35 extern NSString* __nonnull const kSKWPeerSerializationNone;
36 #endif // !DOXYGEN_SKIP_THIS
37 
41 typedef NS_ENUM(NSUInteger, SKWPeerEventEnum)
42 {
67 #ifndef DOXYGEN_SKIP_THIS
68  SKW_PEER_EVENT_REACHABILITY,
70 #endif // !DOXYGEN_SKIP_THIS
71  SKW_PEER_EVENT_AUTH_EXPIRES_IN,
75 };
76 
80 typedef void (^SKWPeerEventCallback)(NSObject* __nullable arg);
81 
82 @class SKWPeerOption;
83 @class SKWConnection;
84 @class SKWPeerCredential;
85 @class SKWDataConnection;
86 @class SKWMediaConnection;
87 @class SKWMediaStream;
88 @class SKWConnectOption;
89 @class SKWCallOption;
90 @class SKWRoom;
91 @class SKWRoomOption;
92 
98 @interface SKWPeer : NSObject
99 
105 @property (nonatomic, readonly) NSString* __nullable identity;
106 
112 @property (nonatomic, readonly) NSDictionary* __nullable connections;
113 
123 @property (nonatomic, readonly) BOOL isDisconnected;
124 
134 @property (nonatomic, readonly) BOOL isDestroyed;
135 
141 + (nonnull NSString*)sdkVersion;
142 
143 #ifndef DOXYGEN_SKIP_THIS
144 - (nonnull instancetype)init NS_UNAVAILABLE;
145 #endif // !DOXYGEN_SKIP_THIS
146 
171 - (instancetype __nullable)initWithOptions:(SKWPeerOption* __nullable)options;
172 
204 - (instancetype __nullable)initWithId:(NSString* __nullable)peerId options:(SKWPeerOption* __nullable)options NS_DESIGNATED_INITIALIZER;
205 
229 - (SKWDataConnection* __nullable)connectWithId:(NSString* __nonnull)peerId;
230 
266 - (SKWDataConnection* __nullable)connectWithId:(NSString* __nonnull)peerId options:(SKWConnectOption* __nullable)options;
267 
296 - (SKWMediaConnection* __nullable)callWithId:(NSString* __nonnull)peerId stream:(SKWMediaStream* __nullable)stream;
297 
333 - (SKWMediaConnection* __nullable)callWithId:(NSString* __nonnull)peerId stream:(SKWMediaStream* __nullable)stream options:(SKWCallOption* __nullable)options;
334 
379 - (void)on:(SKWPeerEventEnum)event callback:(SKWPeerEventCallback __nullable)callback;
380 
399 - (BOOL)disconnect;
400 
411 - (void)reconnect;
412 
429 - (BOOL)destroy;
430 
451 - (void)listAllPeers:(void (^ __nullable)(NSArray * __nullable))callback;
452 
453 #ifndef DOXYGEN_SKIP_THIS
454 - (SKWConnection* __nullable)getConnectionWithId:(NSString* __nonnull)peerId connectionId:(NSString* __nonnull)connectionId;
455 #endif // !DOXYGEN_SKIP_THIS
456 
504 - (SKWRoom* __nullable)joinRoomWithName:(NSString* __nonnull)roomName options:(SKWRoomOption* __nonnull)option;
505 
526 - (void)updateCredential:(SKWPeerCredential* __nonnull)newCredential;
527 
528 @end
SKWDataConnection
Alternative class as DataConnection.
Definition: SKWDataConnection.h:41
-[SKWPeer destroy]
BOOL destroy()
Close the connection to the server and terminate all existing connections.
SKWPeer
A peer class.
Definition: SKWPeer.h:98
SKWMediaStream
Media stream.
Definition: SKWMediaStream.h:18
SKWRoom
Room base class.
Definition: SKWRoom.h:64
-[SKWPeer reconnect]
void reconnect()
Attempt to reconnect to the server with the peer's old ID.
SKWPeerCredential
The credential used to authenticate peer.
Definition: SKWPeerCredential.h:14
SKWPeer::connections
NSDictionary *__nullable connections
A object array of all connections this peer, keyed by the remote peer's ID.
Definition: SKWPeer.h:112
SKWMediaConnection
Alternative class as MediaConnection.
Definition: SKWMediaConnection.h:52
SKWPeer::identity
NSString *__nullable identity
The brokering ID of this peer.
Definition: SKWPeer.h:105
SKW_PEER_EVENT_CONNECTION
@ SKW_PEER_EVENT_CONNECTION
Emitted when a new data connection is established from a remote peer.
Definition: SKWPeer.h:50
SKW_PEER_EVENT_ERROR
@ SKW_PEER_EVENT_ERROR
Errors on the peer are almost always fatal and will destroy the peer.
Definition: SKWPeer.h:66
SKWPeerEventCallback
void(^ SKWPeerEventCallback)(NSObject *__nullable arg)
Peer Event Callback signature.
Definition: SKWPeer.h:80
SKW_PEER_EVENT_CLOSE
@ SKW_PEER_EVENT_CLOSE
Emitted when the peer is destroyed and can no longer accept or create any new connections.
Definition: SKWPeer.h:58
SKW_PEER_EVENT_DISCONNECTED
@ SKW_PEER_EVENT_DISCONNECTED
Emitted when the peer is disconnected from the signalling server, either manually or because the conn...
Definition: SKWPeer.h:62
-[SKWPeer disconnect]
BOOL disconnect()
Close the connection to the server, leaving all existing data and media connections intact.
SKW_PEER_EVENT_CALL
@ SKW_PEER_EVENT_CALL
Emitted when a remote peer attempts to call you.
Definition: SKWPeer.h:54
SKWConnection
Base class of SKWDataConnection and SKWMediaConnection.
Definition: SKWConnection.h:62
SKW_PEER_EVENT_OPEN
@ SKW_PEER_EVENT_OPEN
Emitted when a connection to the PeerServer is established.
Definition: SKWPeer.h:46
SKWPeer::isDestroyed
BOOL isDestroyed
true if this peer and all of its connections can no longer be used.
Definition: SKWPeer.h:134
+[SKWPeer sdkVersion]
nonnull NSString * sdkVersion()
Getting current SDK version.
SKWConnectOption
SKWPeer connect options.
Definition: SKWConnectOption.h:14
SKWPeer::isDisconnected
BOOL isDisconnected
false if there is an active connection to the PeerServer.
Definition: SKWPeer.h:123
SKWCallOption
SKWPeer call options.
Definition: SKWCallOption.h:14
SKWPeerOption
SKWPeer initialize option class.
Definition: SKWPeerOption.h:53
SKWRoomOption
Room Options.
Definition: SKWRoomOption.h:31
SKWPeerEventEnum
SKWPeerEventEnum
Peer event type.
Definition: SKWPeer.h:41