SKYLINKConnection Class Reference
Inherits from | NSObject |
---|---|
Declared in | SKYLINKConnection.h |
Overview
You should make sure this objects does not get released as long as you need it, for example by storing it as a strong property.
Delegates
lifeCycleDelegate
delegate related to life cycle, implementing the SKYLINKConnectionLifeCycleDelegate protocol.
@property (nonatomic, weak) id<SKYLINKConnectionLifeCycleDelegate> lifeCycleDelegate
Declared In
SKYLINKConnection.h
remotePeerDelegate
delegate related to remote peer activities, implementing the SKYLINKConnectionRemotePeerDelegate protocol.
@property (nonatomic, weak) id<SKYLINKConnectionRemotePeerDelegate> remotePeerDelegate
Declared In
SKYLINKConnection.h
mediaDelegate
delegate related to audio/video media, implementing the SKYLINKConnectionMediaDelegate protocol.
@property (nonatomic, weak) id<SKYLINKConnectionMediaDelegate> mediaDelegate
Declared In
SKYLINKConnection.h
messagesDelegate
delegate related to various type of custom messages, implementing the SKYLINKConnectionMessagesDelegate protocol.
@property (nonatomic, weak) id<SKYLINKConnectionMessagesDelegate> messagesDelegate
Declared In
SKYLINKConnection.h
fileTransferDelegate
delegate related to file transfer, implementing the SKYLINKConnectionFileTransferDelegate protocol.
@property (nonatomic, weak) id<SKYLINKConnectionFileTransferDelegate> fileTransferDelegate
Declared In
SKYLINKConnection.h
Peer Id
myPeerId
peer id of the current local user
@property (nonatomic, readonly) NSString *myPeerId
Declared In
SKYLINKConnection.h
maxPeerCount
Maximun number of peers.
@property (nonatomic, assign) NSInteger maxPeerCount
Discussion
The default value depends on the configuration.
Declared In
SKYLINKConnection.h
Lifecycle
– initWithConfig:appKey:
Initialize and return a newly allocated connection object.
- (id)initWithConfig:(SKYLINKConnectionConfig *)config appKey:(NSString *)appKey
Parameters
config |
The connection configuration object. |
---|---|
appKey |
APP key. |
Discussion
Changes in config after creating the object won’t affect the connection.
Declared In
SKYLINKConnection.h
– connectToRoomWithSecret:roomName:userInfo:
Join the room specifiying the shared secret, room name and user info.
- (BOOL)connectToRoomWithSecret:(NSString *)secret roomName:(NSString *)roomName userInfo:(id)userInfo
Parameters
secret |
Shared secret. |
---|---|
roomName |
Name of the room to join. |
userInfo |
User defined information (relating to oneself). May be an NSString, NSDictionary or NSArray. |
Return Value
NO if a connection is already established.
Discussion
It is recommended to use connectToRoomWithCredentials:roomName:userInfo: after calculating the credentials on a server, but if the client application has no server implementation then this one should be used.
Declared In
SKYLINKConnection.h
– connectToRoomWithCredentials:roomName:userInfo:
Join the room specifiying the calculated credential info, room name and user info.
- (NSString *)connectToRoomWithCredentials:(NSDictionary *)credInfo roomName:(NSString *)roomName userInfo:(id)userInfo
Parameters
credInfo |
A dictionary containing a credential, startTime and duration. |
---|---|
roomName |
Name of the room to join. |
userInfo |
User defined information (relating to oneself). May be an NSString, NSDictionary or NSArray. |
Return Value
nil if connection can be established otherwise a message specifying reason for connection denial.
Discussion
The dictionary ‘credInfo’ is expected to have 3 non-Null parameters: an NSString type ‘credential’, an NSDate type ‘startTime’ and an NSNumber type ‘duration’ in hours. The ‘startTime’ must be a correct time of the client application’s timezone. Both the ‘startTime’ and ‘duration’ must be the same as the ones that were used to calculate the credential. Failing to provide any of them will result in a connection denial.
Declared In
SKYLINKConnection.h
– connectToRoomWithStringURL:userInfo:
Join the room specifiying the calculated string URL and user info.
- (BOOL)connectToRoomWithStringURL:(NSString *)stringURL userInfo:(id)userInfo
Parameters
stringURL |
Generated with room name, appKey, secret, startTime and duration. Typed NSString (not NSURL). |
---|---|
userInfo |
User defined information (relating to oneself). May be an NSString, NSDictionary or NSArray. |
Return Value
YES (success) if connection can be established. NO if a connection is already established.
Discussion
Use this method when you calculate the URL on your server with your API key, secret and room name. Allows you to avoid having those parameters in the iOS app code.
Declared In
SKYLINKConnection.h
– disconnect:
Leave the room.
- (void)disconnect:(void ( ^ ) ( ))completion
Parameters
completion |
The completion block called on the UI thread after leaving the room. This block is a good place to deallocate SKYLINKConnection if desired. Leave as empty block if not required. |
---|
Discussion
Leave the room and remove any video renderers and PeerConnections.
Declared In
SKYLINKConnection.h
Room Control.
– refreshConnection:
Refresh peer connection with a specified peer.
- (void)refreshConnection:(NSString *)peerId
Parameters
peerId |
The unique id of the peer with whom the connection is being refreshed. |
---|
Discussion
This method is provided as a convenience method. So that one can call if a peer streams are not behaving correctly.
Declared In
SKYLINKConnection.h
Media
– muteAudio:
Mute/unmute own audio and trigger mute/unmute audio call back for all other peers.
- (void)muteAudio:(BOOL)isMuted
Parameters
isMuted |
Flag to set if audio should be muted. Set to true to mute and false to unmute. |
---|
Declared In
SKYLINKConnection.h
– muteVideo:
Mute/unmute own video and trigger mute/unmute video call back for all other peers.
- (void)muteVideo:(BOOL)isMuted
Parameters
isMuted |
Flag to set if video should be muted. Set to true to mute and false to unmute. |
---|
Declared In
SKYLINKConnection.h
– isAudioMuted
Checks if own audio is currently muted.
- (BOOL)isAudioMuted
Return Value
true if audio is muted and false otherwise.
Declared In
SKYLINKConnection.h
– isVideoMuted
Checks if own video is currently muted.
- (BOOL)isVideoMuted
Return Value
true if video is muted and false otherwise.
Declared In
SKYLINKConnection.h
– switchCamera
Switches between front and back camera. By default the front camera input is captured.
- (void)switchCamera
Declared In
SKYLINKConnection.h
Messaging
– sendCustomMessage:peerId:
Send a custom message (dictionary, array or string) to a peer via signaling server.
- (void)sendCustomMessage:(id)message peerId:(NSString *)peerId
Parameters
message |
User defined message to be sent. May be an NSString, NSDictionary or NSArray. |
---|---|
peerId |
The unique id of the peer to whom the message is sent. |
Discussion
If the ‘peerId’ is not given then the message is broadcasted to all the peers.
Declared In
SKYLINKConnection.h
– sendDCMessage:peerId:
Send a message (dictionary, array or string) to a peer via data channel.
- (void)sendDCMessage:(id)message peerId:(NSString *)peerId
Parameters
message |
User defined message to be sent. May be an NSString, NSDictionary, NSArray. |
---|---|
peerId |
The unique id of the peer to whom the message is sent. |
Discussion
If the ‘peerId’ is not given then the message is broadcasted to all the peers.
Declared In
SKYLINKConnection.h
– sendBinaryData:peerId:
Send binary data to a peer via data channel.
- (void)sendBinaryData:(NSData *)data peerId:(NSString *)peerId
Parameters
data |
Binary data to be sent to the peer. The maximum size the method expects is 65456 bytes. |
---|---|
peerId |
The unique id of the peer to whom the data is sent. |
Discussion
If the ‘peerId’ is not given then the data is sent to all the peers. If the caller passes data object exceeding the maximum length i.e. 65456, excess bytes are truncated to the limit before sending the data on to the channel.
Declared In
SKYLINKConnection.h
File Transfer
– sendFileTransferRequest:assetType:peerId:
This will trigger a file permission event at a peer.
- (void)sendFileTransferRequest:(NSURL *)fileURL assetType:(SKYLINKAssetType)assetType peerId:(NSString *)peerId
Parameters
fileURL |
The url of the file to send. |
---|---|
assetType |
The type of the asset to send. |
peerId |
The unique id of the peer to whom the file would be sent. |
Exceptions
exception |
An exception will be raised if there is already a file transfer being done with the same peer. |
---|
Declared In
SKYLINKConnection.h
– sendFileTransferRequest:assetType:
This will trigger a broadcast file permission event at all peers in the room.
- (void)sendFileTransferRequest:(NSURL *)fileURL assetType:(SKYLINKAssetType)assetType
Parameters
fileURL |
The url of the file to send. |
---|---|
assetType |
The type of the asset to send. |
Discussion
If all the data channel connections are busy in some file transfer then this message will be ignored. If one or more data channel connections are not busy in some file transfer then this will trigger a broadcast file permission event at the available peers.
Declared In
SKYLINKConnection.h
– acceptFileTransfer:filename:peerId:
Accept or reject the file transfer request from a peer.
- (void)acceptFileTransfer:(BOOL)accept filename:(NSString *)filename peerId:(NSString *)peerId
Parameters
accept |
Flag to specify whether the request is accepted. |
---|---|
filename |
The name of the file in request. |
peerId |
The unique id of the peer who sent the file transfer request. |
Declared In
SKYLINKConnection.h
– cancelFileTransfer:peerId:
Cancel the existing on going transfer at anytime.
- (void)cancelFileTransfer:(NSString *)filename peerId:(NSString *)peerId
Parameters
filename |
The name of the file in request (optional). |
---|---|
peerId |
The unique id of the peer with whom file is being transmitted. |
Declared In
SKYLINKConnection.h
Miscellaneous
– sendUserInfo:
Update user information for every other peer and triggers user info call back at all the other peer’s end.
- (void)sendUserInfo:(id)userInfo
Parameters
userInfo |
User defined information. May be an NSString, NSDictionary or NSArray. |
---|
Declared In
SKYLINKConnection.h
– getUserInfo:
Get the cached user info for a particular peer.
- (id)getUserInfo:(NSString *)peerId
Parameters
peerId |
The unique id of the peer. |
---|
Return Value
User defined information. May be an NSString, NSDictionary or NSArray.
Declared In
SKYLINKConnection.h
Utility
+ getSkylinkVersion
Get the version string of this Skylink SDK for iOS.
+ (NSString *)getSkylinkVersion
Return Value
Version string of this Skylink SDK for iOS.
Declared In
SKYLINKConnection.h
+ setVerbose:
Enable/disable verbose logs for all the connections.
+ (void)setVerbose:(BOOL)verbose
Parameters
verbose |
enable/disable verbose logs. Default is NO. |
---|
Discussion
Warning: You should always disable logs in RELEASE mode.
Declared In
SKYLINKConnection.h
+ calculateCredentials:duration:startTime:secret:
Calculate credentials to be used by the connection.
+ (NSString *)calculateCredentials:(NSString *)roomName duration:(NSNumber *)duration startTime:(NSDate *)startTime secret:(NSString *)secret
Parameters
roomName |
Name of the room. |
---|---|
duration |
Duration of the call in hours. |
startTime |
Start time of the call as per client application time zone. |
secret |
The shared secret. |
Return Value
The calculated credential string.
Declared In
SKYLINKConnection.h