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 {
59 
70  SKW_PEER_EVENT_DISCONNECTED __attribute__((deprecated("this event is not fired"))),
75 #ifndef DOXYGEN_SKIP_THIS
76  SKW_PEER_EVENT_REACHABILITY,
78 #endif // !DOXYGEN_SKIP_THIS
79  SKW_PEER_EVENT_AUTH_EXPIRES_IN,
83 };
84 
88 typedef void (^SKWPeerEventCallback)(NSObject* __nullable arg);
89 
90 @class SKWPeerOption;
91 @class SKWConnection;
92 @class SKWPeerCredential;
93 @class SKWDataConnection;
94 @class SKWMediaConnection;
95 @class SKWMediaStream;
96 @class SKWConnectOption;
97 @class SKWCallOption;
98 @class SKWRoom;
99 @class SKWRoomOption;
100 
106 @interface SKWPeer : NSObject
107 
113 @property (nonatomic, readonly) NSString* __nullable identity;
114 
120 @property (nonatomic, readonly) NSDictionary* __nullable connections;
121 
131 @property (nonatomic, readonly) BOOL isDisconnected;
132 
142 @property (nonatomic, readonly) BOOL isDestroyed;
143 
149 + (nonnull NSString*)sdkVersion;
150 
151 #ifndef DOXYGEN_SKIP_THIS
152 - (nonnull instancetype)init NS_UNAVAILABLE;
153 #endif // !DOXYGEN_SKIP_THIS
154 
181 - (instancetype __nullable)initWithOptions:(SKWPeerOption* __nullable)options;
182 
216 - (instancetype __nullable)initWithId:(NSString* __nullable)peerId options:(SKWPeerOption* __nullable)options NS_DESIGNATED_INITIALIZER;
217 
241 - (SKWDataConnection* __nullable)connectWithId:(NSString* __nonnull)peerId;
242 
278 - (SKWDataConnection* __nullable)connectWithId:(NSString* __nonnull)peerId options:(SKWConnectOption* __nullable)options;
279 
308 - (SKWMediaConnection* __nullable)callWithId:(NSString* __nonnull)peerId stream:(SKWMediaStream* __nullable)stream;
309 
345 - (SKWMediaConnection* __nullable)callWithId:(NSString* __nonnull)peerId stream:(SKWMediaStream* __nullable)stream options:(SKWCallOption* __nullable)options;
346 
391 - (void)on:(SKWPeerEventEnum)event callback:(SKWPeerEventCallback __nullable)callback;
392 
403 - (BOOL)disconnect __attribute__((deprecated("use destroy method instead")));
404 
414 - (void)reconnect __attribute__((deprecated("recreate a Peer instance instead")));
415 
432 - (BOOL)destroy;
433 
454 - (void)listAllPeers:(void (^ __nullable)(NSArray * __nullable))callback;
455 
485 - (void)fetchPeerExistsWithPeerId:(NSString* __nonnull)peerId success:(void (^ __nonnull)(BOOL))successCallback error:(void (^ __nullable)(NSString* __nonnull))errorCallback;
486 
487 #ifndef DOXYGEN_SKIP_THIS
488 - (SKWConnection* __nullable)getConnectionWithId:(NSString* __nonnull)peerId connectionId:(NSString* __nonnull)connectionId;
489 #endif // !DOXYGEN_SKIP_THIS
490 
538 - (SKWRoom* __nullable)joinRoomWithName:(NSString* __nonnull)roomName options:(SKWRoomOption* __nonnull)option;
539 
560 - (void)updateCredential:(SKWPeerCredential* __nonnull)newCredential;
561 
562 @end
SKWDataConnection
Alternative class as DataConnection.
Definition: SKWDataConnection.h:41
-[SKWPeer destroy]
BOOL destroy()
Close the connection to the signaling server and the already connected mediaConnection and dataConnec...
SKWPeer
A peer class.
Definition: SKWPeer.h:106
SKWMediaStream
Media stream.
Definition: SKWMediaStream.h:18
SKWRoom
Room base class.
Definition: SKWRoom.h:70
-[SKWPeer reconnect]
void reconnect()
(deprecated) Reconnect to the signaling server.
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:120
SKWMediaConnection
Alternative class as MediaConnection.
Definition: SKWMediaConnection.h:52
SKWPeer::identity
NSString *__nullable identity
The brokering ID of this peer.
Definition: SKWPeer.h:113
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:74
SKWPeerEventCallback
void(^ SKWPeerEventCallback)(NSObject *__nullable arg)
Peer Event Callback signature.
Definition: SKWPeer.h:88
SKW_PEER_EVENT_CLOSE
@ SKW_PEER_EVENT_CLOSE
Emitted when peer.destroy() is executed.
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:70
-[SKWPeer disconnect]
BOOL disconnect()
(deprecated) Close the connection to the signaling server.
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:142
+[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:131
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