CjConnectivity
Instance Methods | Protected Types | Properties | List of all members
CjConnectivity Class Reference
Inheritance diagram for CjConnectivity:

Instance Methods

(id) - initWithToken:myDeviceId:
 Initializes library and sets local device unique ID. More...
 
(void) - deinit
 Disconnects from other device if needed and deinitializes library.
 
(CoError- sendMsg:toOtherDeviceId:
 Send message to other device via signaling. More...
 
(CoError- connectToOtherDeviceId:
 Establish a data connection to another device. More...
 
(BOOL) - isConnected
 Check if we have a data connection with the other device. More...
 
(BOOL) - isConnectedViaConnectionType:
 Check if we have a data connection with the other device via a specific data connection type. More...
 
(CoError- sendVideoH264Frame:
 Send H.264 video frame (NALU). More...
 
(CoError- sendVideoH264DataChunk:
 Send H.264 video data chunk. More...
 
(CoError- sendAudioFrames:
 Send audio frames. More...
 
(CoError- sendOtherData:
 Send data that is neither H.264 video nor audio. More...
 
(void) - disconnect
 Disconnects from other device.
 
(void) - registerPushNotificationsFromDevice:myDeviceToken:
 Registers this device's token to receive push notifications from other device. More...
 
(CoError- sendPushNotificationMsg:action:
 Send push notification to other device. More...
 

Protected Types

enum  CoConnectionEvent {
  CoConnectionEventIncreaseVideoBitrate = 8,
  CoConnectionEventReduceVideoBitrate = 7,
  CoConnectionEventMessagingReady = 6,
  CoConnectionEventDisconnectNetworkChange = 5,
  CoConnectionEventDisconnectPeerStoppedResponding = 4,
  CoConnectionEventDisconnectSignalReceivedFromPeer = 3,
  CoConnectionEventConnecting = 2,
  CoConnectionEventConnectSuccessOtherConnectionType = 1,
  CoConnectionEventConnectSuccess = 0,
  CoConnectionEventConnectFailTokenError = -1,
  CoConnectionEventConnectFailTokenExpired = -2,
  CoConnectionEventConnectFailTimeout = -3,
  CoConnectionEventConnectFailMaxConnectionsExceeded = -4,
  CoConnectionEventConnectFailVersionTooOld = -5,
  CoConnectionEventConnectFailOtherDeviceVersionTooOld = -6,
  CoConnectionEventConnectFailSessionMaxTimeReached = -7
}
 CoConnectionEvent gives information about events occurring with a specific connection. More...
 
enum  CoDataType {
  CoDataTypeNone,
  CoDataTypeVideo,
  CoDataTypeAudio,
  CoDataTypeOther
}
 
enum  CoConnectionType {
  CoConnectionTypeNone,
  CoConnectionTypeLocal,
  CoConnectionTypeP2P,
  CoConnectionTypeServer,
  CoConnectionTypeAll
}
 The CoConnectionType indicates what kind of connection we are dealing with (direct local connection, peer-to-peer via public internet, or via server relay). More...
 
enum  CoError {
  CoSuccess = 0,
  CoFailure = -1,
  CoBadParameter = -2,
  CoInternalError = -3,
  CoUninitialized = -4,
  CoAlreadyInitialized = -5,
  CoTokenError = -6,
  CoTokenExpired = -7,
  CoOffline = -8,
  CoDisconnected = -9,
  CoMaxConnectionsExceeded = -10,
  CoTokenMinReconnectInterval = -11
}
 Most methods will return an CoError code. The code indicates success or what type of failure happened. More...
 

Properties

id< CjConnectivityDelegatedelegate
 

Member Enumeration Documentation

◆ CoConnectionEvent

- (enum) CoConnectionEvent
protected

CoConnectionEvent gives information about events occurring with a specific connection.

Enumerator
CoConnectionEventIncreaseVideoBitrate 

Network conditions are good enough for a higher bitrate than the one currently used. Increase the video resolution/bitrate when receiving this event.

CoConnectionEventReduceVideoBitrate 

Network conditions are not good enough for current bitrate. Reduce the video resolution/bitrate when receiving this event.

CoConnectionEventMessagingReady 

Device is ready to receive messages to its unique ID.

CoConnectionEventDisconnectNetworkChange 

Got disconnected because of a network change (such as network lost for example).

CoConnectionEventDisconnectPeerStoppedResponding 

Peer stopped responding, indicating that peer either crashed or lost its network connection.

CoConnectionEventDisconnectSignalReceivedFromPeer 

Peer sent disconnection request.

CoConnectionEventConnecting 

Received a connection request and started initiating connection.

CoConnectionEventConnectSuccessOtherConnectionType 

Connection was successful on one of the other two of three connection types (CoConnectionType). Gets received on second and third successful connection type.

CoConnectionEventConnectSuccess 

Connection was successful. Gets received when first of 3 possible connection types gets established.

CoConnectionEventConnectFailTokenError 

Something is wrong with the token provided.

CoConnectionEventConnectFailTokenExpired 

The token provided is expired.

CoConnectionEventConnectFailTimeout 

It took too long to attempt the connection. Perhaps the other device is not connected to the network.

CoConnectionEventConnectFailMaxConnectionsExceeded 

Already attempted the maximum number of connections allowed.

CoConnectionEventConnectFailVersionTooOld 

This device's version is too old and not compatible with other device.

CoConnectionEventConnectFailOtherDeviceVersionTooOld 

Other device's version is too old and not compatible with this device.

CoConnectionEventConnectFailSessionMaxTimeReached 

The token used has a session maximum time limit and that limit has been reached. Contact suppo.nosp@m.rt@s.nosp@m.eajei.nosp@m..com to get a token with no limit.

◆ CoConnectionType

- (enum) CoConnectionType
protected

The CoConnectionType indicates what kind of connection we are dealing with (direct local connection, peer-to-peer via public internet, or via server relay).

Enumerator
CoConnectionTypeNone 

No associated connection type.

CoConnectionTypeLocal 

Connection over same local network.

CoConnectionTypeP2P 

Peer-to-peer connection over the public internet.

CoConnectionTypeServer 

Connection via relay server.

CoConnectionTypeAll 

Encompasses all connection types (such as for example when receiving and overall timeout event).

◆ CoError

- (enum) CoError
protected

Most methods will return an CoError code. The code indicates success or what type of failure happened.

Enumerator
CoSuccess 

Success return value. No error occurred.

CoFailure 

A generic error. Not enough information for a specific error code.

CoBadParameter 

An input parameter is bad.

CoInternalError 

An internal error has occurred.

CoUninitialized 

Trying to call functions that need initialization first.

CoAlreadyInitialized 

Trying to initialize but we are already initialized.

CoTokenError 

There was an error with the token.

CoTokenExpired 

Token status is expired.

CoOffline 

The network connection is offline.

CoDisconnected 

The data connection is disconnected.

CoMaxConnectionsExceeded 

Already attempted the maximum number of connections allowed.

CoTokenMinReconnectInterval 

Attempted to reconnect more quickly than minimum interval tied to this token. Contact suppo.nosp@m.rt@s.nosp@m.eajei.nosp@m..com to get your own token to remove this limitation.

Method Documentation

◆ connectToOtherDeviceId:()

- (CoError) connectToOtherDeviceId: (NSString *)  otherDeviceId

Establish a data connection to another device.

Data connection will be used to stream video, audio or other type of data.

Parameters
otherDeviceIdThe unique ID of the destination device.
Returns
Error code.

◆ initWithToken:myDeviceId:()

- (id) initWithToken: (NSString *)  token
myDeviceId: (NSString *)  myDeviceId 

Initializes library and sets local device unique ID.

Parameters
tokenA unique token (please contact suppo.nosp@m.rt@s.nosp@m.eajei.nosp@m..com to obtain yours).
myDeviceIdUnique device ID for this device. Maximum length is 32.

◆ isConnected()

- (BOOL) isConnected

Check if we have a data connection with the other device.

Returns
YES if connected, NO otherwise.

◆ isConnectedViaConnectionType:()

- (BOOL) isConnectedViaConnectionType: (CoConnectionType connectionType

Check if we have a data connection with the other device via a specific data connection type.

Parameters
connectionTypeThe type of connection we want to check.
Returns
YES if connected, NO otherwise.

◆ registerPushNotificationsFromDevice:myDeviceToken:()

- (void) registerPushNotificationsFromDevice: (NSString *)  otherDeviceId
myDeviceToken: (NSString *)  myDeviceToken 

Registers this device's token to receive push notifications from other device.

Parameters
otherDeviceIdThe unique ID of the destination device.
myDeviceTokenDevice token for this device.

◆ sendAudioFrames:()

- (CoError) sendAudioFrames: (NSData *)  audioFrames

Send audio frames.

After a number of audio frames are captured from the microphone (and typically encoded with an audio codec), use this function to send it.

Parameters
audioFramesThe audio frames. Maximum size is 916. If size is bigger, separate the audioFrames into smaller pieces and send those.
Returns
Error code.

◆ sendMsg:toOtherDeviceId:()

- (CoError) sendMsg: (NSString *)  msg
toOtherDeviceId: (NSString *)  otherDeviceId 

Send message to other device via signaling.

There is no need to establish a connection first. Message is guaranteed to be received if both devices are connected to the internet and both devices have been initialized and received the CoConnectionEventMessagingReady connection event. Use for small messages only (up to 5 KB), not for streaming audio or video.

Parameters
msgThe message to send.
otherDeviceIdThe unique ID of the destination device.
Returns
Error code.

◆ sendOtherData:()

- (CoError) sendOtherData: (NSData *)  data

Send data that is neither H.264 video nor audio.

Parameters
dataThe data to be sent.
Returns
Error code.
Note
This data is getting sent over UDP as is, with no resending.

◆ sendPushNotificationMsg:action:()

- (CoError) sendPushNotificationMsg: (NSString *)  msg
action: (NSString *)  action 

Send push notification to other device.

Sending push notifications will only work if other device previously registered push notifications.

Parameters
msgText that gets displayed in push notification.
actionThe action string gets embedded into the push notification and can be retrieved on the app side when user taps notification.
Returns
Error code.
Note
Enabling push notifications to work with your own app requires Seajei to enable it. Please contact Seajei at suppo.nosp@m.rt@s.nosp@m.eajei.nosp@m..com.

◆ sendVideoH264DataChunk:()

- (CoError) sendVideoH264DataChunk: (NSData *)  h264DataChunk

Send H.264 video data chunk.

In case random lengths of partial frame data (ordered) are captured (rather than full frames), use this function as it will figure out the beginnings and ends of frames and send them out.

Parameters
h264DataChunkThe partial frame data.
Returns
Error code.

◆ sendVideoH264Frame:()

- (CoError) sendVideoH264Frame: (NSData *)  h264Frame

Send H.264 video frame (NALU).

Send iFrame, pFrame, SPS, or PPS. SPS/PPS, or SPS/PPS/iFrame may be combined into a single frame.

Parameters
h264FrameThe frame.
Returns
Error code.

The documentation for this class was generated from the following file: