CloudHub Docs
Download Documents

RTC


CloudHubSDK iOS

CloudHubRtcChannelDelegate

Unless otherwise specified, delegete’s callback methods all run on the main thread

Channel Event

rtcChannel:didOccurError:withMessage:

An error callback occurred

- (void)rtcChannel:(CloudHubRtcChannelKit * _Nonnull)channel
     didOccurError:(CloudHubErrorCode)errorCode
       withMessage:(NSString * _Nonnull)message;
ParametersDescribe
channelCloudHubRtcChannelKit Instance pointer
errorCodeCloudHubErrorCode Error code
messageError description

Discussion

This callback indicates an internal error in the SDK

rtcChannel:didJoinChannelwithUid:elapsed:

Set channel scene

- (void)      rtcChannel:(CloudHubRtcChannelKit * _Nonnull)channel
   didJoinChannelwithUid:(NSString * _Nonnull)uid
                 elapsed:(NSInteger) elapsed;
ParametersDescribe
channelCloudHubRtcChannelKit Instance pointer
uidUser ID: if uid is specified in thejoinChannelByToken:properties:uid:autosubscribeAudio:autoSubscribeVideo:joinSuccess: method, it will return the specified ID; If not, it will return the data automatically assigned by CloudHubRtcChannelKit
elapsedFrom call joinChannelByToken:properties:uid:autosubscribeAudio:autoSubscribeVideo:joinSuccess: to happen this Event in the past time (ms)

Discussion

This callback method indicates that the client successfully joined the specified channel, as in joinChannelByToken:properties:uid:autosubscribeAudio:autoSubscribeVideo:joinSuccess: joinSuccessBlock callback

rtcChannel:didReJoinChannelwithUid:elapsed:

Rejoin the channel callback

- (void)       rtcChannel:(CloudHubRtcChannelKit * _Nonnull)channel
  didReJoinChannelwithUid:(NSString * _Nonnull)uid
                  elapsed:(NSInteger) elapsed;
ParametersDescribe
channelCloudHubRtcChannelKit Instance pointer
uidThe joinChannelByToken:properties:uid:autosubscribeAudio:autoSubscribeVideo:joinSuccess: method specifies the uid, which returns the specified Id. If not, it will return automatically allocated by CloudHubRtcChannelKit
elapsedThe time (ms) between the call tojoinChannelByToken:properties:uid:autosubscribeAudio:autoSubscribeVideo:joinSuccess: and the occurrence of this Event

Discussion

Sometimes, the client may lose the connection to the server due to network problems. The SDK automatically reconnects the client to the server. When the reconnection succeeds, the callback method is triggered

rtcChannel:didLeaveChannel:

Leave channel callback

- (void)rtcChannel:(CloudHubRtcChannelKit * _Nonnull)channel
   didLeaveChannel:(CloudHubChannelStats * _Nonnull)stats;
ParametersDescribe
channelCloudHubRtcChannelKit Instance pointer
statsStatistics :See CloudHubChannelStats

Discussion

The SDK triggers this callback when the user calls leaveChannel: to leave the channel

rtcChannel:onClientRoleChangedFrom:to:

The user role has been switched back in live broadcast scenarios

- (void)      rtcChannel:(CloudHubRtcChannelKit * _Nonnull)channel
 onClientRoleChangedFrom:(CloudHubClientRole)oldRole
                      to:(CloudHubClientRole)newRole;
ParametersDescribe
channelCloudHubRtcChannelKit Instance pointer
oldRoleCloudHubClientRole The role before switching
newRoleCloudHubClientRole The role after switching

Discussion

In a live broadcast scenario, this callback is triggered when a local user calls setClientRole: In a live broadcast scenario, this callback is triggered when a local user calls

rtcChannel:didJoinedOfUid:properties:isHistory:fromChannel:

Remote user (communication scenario) or anchor (live broadcast scenario) joins the callback of the current channel

- (void)rtcChannel:(CloudHubRtcChannelKit * _Nonnull)channel
    didJoinedOfUid:(NSString * _Nonnull)uid
        properties:(NSString * _Nullable)properties
         isHistory:(BOOL)isHistory
       fromChannel:(NSString* _Nonnull)srcChannel;
ParametersDescribe
channelCloudHubRtcChannelKit Instance pointer
uidIf the UID is specified in joinChannelByToken:properties:uid:autosubscribeAudio:autoSubscribeVideo:joinSuccess: , the UID is returned. Otherwise, use the ID automatically assigned byCloudHubRtcChannelKit
propertiesjoinChannelByToken:properties:uid:autosubscribeAudio:autoSubscribeVideo:joinSuccess: and setPropertyOfUid:tell:properties: interfaces can specify a custom attributes
isHistoryWhether the user joined the channel before the local user
srcChannelWhen there is cross-channel media flow from other channels to this channel,This channel user will receive a rtcChannel:didJoinedOfUid:properties:isHistory:fromChannel:,at this time srcChannel orward for the media stream source channel of the channel number, other cases the value is an empty string

Discussion

In communication scenarios, this callback prompts a remote user to join a channel and returns the ID of the new user. If there are already other users in the channel before joining, new users will also receive a callback for those existing users joining the channel, in which case isHistory is YES

In the live broadcast scenario, the callback prompts an anchor to join the channel and returns the ID of the anchor. If there is already an anchor in the channel before joining, the newly joined user will also receive the callback of the anchor joining the channel

This callback is triggered when:

Note:

rtcChannel:didOfflineOfUid:reason:

Remote user (communication scenario) or anchor (live broadcast scenario) callback when leaving the current channel

- (void)rtcChannel:(CloudHubRtcChannelKit * _Nonnull)channel
   didOfflineOfUid:(NSString * _Nonnull)uid
            reason:(NSInteger)reason;
ParametersDescribe
channelCloudHubRtcChannelKit Instance pointer
uidID of the remote user or anchor leaving the channel
reasonThe reason for the user to leave

Discussion

A message is displayed indicating that a remote user or anchor has left the channel (or is offline). There are two reasons for the user to leave the channel, namely, normal departure and timeout disconnection (unable to communicate with the server for more than 30 seconds).

The reasons for the user to leave have the following values:

valueDescribe
1The user called leaveChannel: to actively leave the channel
2Timeout dropped due to not receiving packets from the other side for too long
3The user is kicked off the channel
4Left channel because same user ID entered channel
5Kicked out all users because the server actively closed the channel
6The user role is changed from anchor to viewer
7Left channel for unknown reason
8Cross - room passage closed voluntarily
9The cross-room channel connection is disconnected

rtcChannel:connectionChangedToState:

The network connection status has changed

- (void)       rtcChannel:(CloudHubRtcChannelKit * _Nonnull)channel
 connectionChangedToState:(CloudHubConnectionStateType)state;
ParametersDescribe
channelCloudHubRtcChannelKit Instance pointer
stateCurrent network connection status,See CloudHubConnectionStateType

Discussion

This callback is triggered when the network connection status changes and informs the user of the current network connection status

rtcChannel:tokenPrivilegeWillExpire:

Token is about to expire callback in 30 seconds

- (void)       rtcChannel:(CloudHubRtcChannelKit * _Nonnull)channel
 tokenPrivilegeWillExpire:(NSString *_Nonnull)token;
ParametersDescribe
channelCloudHubRtcChannelKit Instance pointer
tokenToken that is about to expire

Discussion

If Token is specified when calling joinChannelByToken:properties:uid:autosubscribeAudio:autoSubscribeVideo:joinSuccess: ,Since the Token has a certain time limit,If the Token is about to expire during a call, the SDK will trigger this callback 30 seconds in advance to remind the application to update the Token .When the callback is received, the user needs to re-generate new Token on the server and then call renewToken: to pass the newly generated Token to the SDK

rtcChannelRequestToken:

Token has expired and needs to be renewed

- (void)rtcChannelRequestToken:(CloudHubRtcChannelKit * _Nonnull)channel;
ParametersDescribe
channelCloudHubRtcChannelKit Instance pointer

Discussion

If Token is specified when calling joinChannelByToken:properties:uid:autosubscribeAudio:autoSubscribeVideo:joinSuccess: ,Since the Token has a certain time limit ,If the Token has been invalidated during the call, the SDK will trigger the callback immediately.Remind the application to update the Token,When the callback is received, the user needs to re-generate new Token on the server and then call renewToken: to pass the newly generated Token to the SDK

Remote publishing of Event (only for when auto-subscription mode is turned off)

rtcChannel:onUserPublished:type:stream:

Remote users start posting audio and video callbacks

- (void) rtcChannel:(CloudHubRtcChannelKit * _Nonnull)channel
    onUserPublished:(NSString * _Nonnull)uid
               type:(CloudHubMediaType)type
             stream:(NSString * _Nonnull)streamId;
ParametersDescribe
channelCloudHubRtcChannelKit Instance pointer
uidUser id of the posted video stream
typeVideo stream type: may be audio, video, screen sharing, etc. See CloudHubMediaType
streamIdThis is the only Id for the stream in the channel: This Id is required when using the Plus version of the Access Point to subscribe/play/set up remote streaming methods.

Discussion

When a user in the channel publishes an audio/video stream successfully, the callback will be received locally if the automatic subscription is turned off, If you decide to watch this breast, you will need to call subscribe and receive the rtcChannel:remoteVideoStateChangedOfUid:streamId:type:state:reason: callback upon success, Local if not closed automatically subscribe to, can directly receive rtcChannel:remoteVideoStateChangedOfUid:streamId:type:state:reason: callback

rtcChannel:onUserUnPublished:type:stream:

The remote user stops publishing audio and video callbacks

- (void) rtcChannel:(CloudHubRtcChannelKit * _Nonnull)channel
  onUserUnPublished:(NSString * _Nonnull)uid
               type:(CloudHubMediaType)type
             stream:(NSString * _Nonnull)streamId;
ParametersDescribe
channelCloudHubRtcChannelKit Instance pointer
uidUser id of the posted video stream
typeVideo stream type: may be audio, video, screen sharing, etc. SeeCloudHubMediaType
streamIdThis is the only Id for the stream in the channel: This Id is required when using the Plus version of the Access Point to subscribe/play/set up remote streaming methods.

Discussion

When a user stops streaming audio and video, the local user will receive this callback if the automatic subscription is turned off. In this case, the unSubscribe method is not required

Audio Event

rtcChannel:firstRemoteAudioFrameOfUid:

First frame callback of remote audio received

- (void)         rtcChannel:(CloudHubRtcChannelKit * _Nonnull)channel
 firstRemoteAudioFrameOfUid:(NSString * _Nonnull)uid;
ParametersDescribe
channelCloudHubRtcChannelKit Instance pointer
uidUser UID of the remote audio stream

rtcChannel:remoteAudioStateChangedOfUid:state:reason:

The state of the remote audio stream has changed

- (void)          rtcChannel:(CloudHubRtcChannelKit * _Nonnull)channel
remoteAudioStateChangedOfUid:(NSString * _Nonnull)uid
                       state:(CloudHubAudioRemoteState)state
                      reason:(CloudHubAudioRemoteStateReason)reason;
ParametersDescribe
channelCloudHubRtcChannelKit Instance pointer
uidUser UID of the remote audio stream
stateNew audio stream state, SeeCloudHubAudioRemoteState
reasonThe reasons for the change, SeeCloudHubAudioRemoteStateReason

Discussion

When the audio status of a remote user or anchor changes, the SDK triggers this callback to report the current remote audio flow status to the local user

rtcChannel:reportAudioVolumeIndication:totalVolume:

Speaker volume prompts callback

- (void)          rtcChannel:(CloudHubRtcChannelKit * _Nonnull)channel
reportAudioVolumeIndication:(NSArray * _Nonnull)speakers
                totalVolume:(NSInteger)totalVolume;
ParametersDescribe
channelCloudHubRtcChannelKit Instance pointer
speakersCloudHubAudioVolumeInfo array
•In the local user callback, this array contains the following members:
uid,Uid of local user;
volume totalVolume, indicates the volume of the local user after mixing;
vad,Indicates the voice status of a local user;
channelId, which channel the current speaker is on
In the callback from the remote user, this array contains the following members:
uid, Represents the respective user ID of each speaker;
volume, Represents the volume of the speaker’s respective remix;
vad = 0, Indicates that it is invalid for remote users.
channelId, Indicates which channel the current speaker is on. If the reported Speakers array is empty, no one is speaking on the remote end at this time
volumeTotal volume (after mixing), value range: [0,255]
In the local user callback, totalVolume is the volume of the local user after mixing
In the callback of the remote user, totalVolume is the totalVolume of all speakers after mixing

Discussion

This callback reports the user IDS of the highest volume users (up to three) within the channel, their volume, and whether the local user is talking

This callback is disabled by default and can be enabled using the enableAudioVolumeIndication:smooth:reportVAD: method; When enabled, the SDK will trigger this callback at the interval set in the enableAudioVolumeIndication:smooth:reportVAD: method, regardless of whether someone is talking in the channel, Each time, the user receives two independent callback messages, one containing the volume information of the local user and the other containing the volume information of all remote users. For details, see the preceding parameter description

rtcChannel:onActiveSpeaker:

Remote most active user callback detected

- (void)rtcChannel:(CloudHubRtcChannelKit * _Nonnull)channel
  onActiveSpeaker:(NSString * _Nonnull)uid;
ParametersDescribe
uidID of the most active remote user

Discussion

After a successful call to enableAudioVolumeIndication:smooth:reportVAD: , the SDK continuously monitors the loudest remote user and counts the number of times that user is judged to be loudest. In the current time range, the remote user whose number of times accumulates the most is the most active user.

When the number of users in the channel is greater than or equal to 2 and there are active users, the SDK triggers this callback and reports the UID of the most active user.

Remote video Event

rtcChannel:remoteVideoStateChangedOfUid:streamId:type:state:reason:

The remote video stream state has changed callback

- (void)           rtcChannel:(CloudHubRtcChannelKit * _Nonnull)channel
 remoteVideoStateChangedOfUid:(NSString * _Nonnull)uid
                     streamId:(NSString * _Nonnull)streamId
                         type:(CloudHubMediaType)type
                        state:(CloudHubVideoRemoteState)state
                       reason:(CloudHubVideoRemoteStateReason)reason;
ParametersDescribe
channelCloudHubRtcChannelKit Instance pointer
uidUser UID of the remote video stream
streamIdThis is the only Id for the stream in the channel: This Id is required when using the Plus version of the Access Point to subscribe/play/set up remote streaming methods.
typeVideo stream type: may be audio, video, screen sharing, etc. SeeCloudHubMediaType
stateNew audio stream state, SeeCloudHubVideoRemoteState
reasonThe reasons for the change, SeeCloudHubVideoRemoteStateReason

Discussion

When the video status of a remote user or host changes, the SDK triggers the callback to report the current remote video stream status to the local user

Each user may have multiple video streams, and each video channel has its type. StreamId is the unique identification of a video stream within the channel

rtcChannel:firstRemoteVideoFrameOfUID:streamId:type:Size:

The first frame callback of the remote video is displayed

- (void)        rtcChannel:(CloudHubRtcChannelKit * _Nonnull)channel
firstRemoteVideoFrameOfUID:(NSString * _Nonnull)uid
                  streamId:(NSString * _Nonnull)streamId
                      type:(CloudHubMediaType)type
                      Size:(CGSize)size;
ParametersDescribe
channelCloudHubRtcChannelKit Instance pointer
uidUser UID of the remote video stream
streamIdThis is the only Id for the stream in the channel: This Id is required when using the Plus version of the Access Point to subscribe/play/set up remote streaming methods.
typeVideo stream type: may be audio, video, screen sharing, etc. SeeCloudHubMediaType
sizeWidth and height of the first video frame

Discussion

After the first video frame is received and decoded successfully, the callback will be triggered in two cases:

rtcChannel:remoteVideoSizeChangedOfUID:streamId:type:size:

The remote video stream width and height has changed back

- (void)         rtcChannel:(CloudHubRtcChannelKit * _Nonnull)channel
remoteVideoSizeChangedOfUID:(NSString * _Nonnull)uid
                   streamId:(NSString * _Nonnull)streamId
                       type:(CloudHubMediaType)type
                       size:(CGSize)size;
ParametersDescribe
channelCloudHubRtcChannelKit Instance pointer
uidUser UID of the remote video stream
streamIdThis is the only Id for the stream in the channel: This Id is required when using the Plus version of the Access Point to subscribe/play/set up remote streaming methods.
typeVideo stream type: may be audio, video, screen sharing, etc. SeeCloudHubMediaType
sizeWidth and height of the first video frame

Data Statistics Event

rtcChannel:remoteAudioStats:

Callback statistics of remote audio streams during a call

- (void) rtcChannel:(CloudHubRtcChannelKit * _Nonnull)channel
   remoteAudioStats:(CloudHubRtcRemoteAudioStats * _Nonnull)stats;
ParametersDescribe
channelCloudHubRtcChannelKit Instance pointer
statsRemote audio statistics,See CloudHubRtcRemoteAudioStats

Discussion

This callback describes the end-to-end audio flow statistics of a remote user during a call. It is triggered every 2 seconds for each remote user or anchor

If multiple users or anchors exist on the remote end, the callback will be triggered multiple times every two seconds

rtcChannel:remoteVideoStats:

Callback statistics of remote video stream during a call

- (void) rtcChannel:(CloudHubRtcChannelKit * _Nonnull)channel
   remoteVideoStats:(CloudHubRtcRemoteVideoStats * _Nonnull)stats;
ParametersDescribe
channelCloudHubRtcChannelKit Instance pointer
statsRemote video statistics, See CloudHubRtcRemoteVideoStats

Discussion

This callback describes the end-to-end video stream statistics of a remote user during a call. It is triggered every 2 seconds for each remote user or anchor

If multiple users or anchors exist on the remote end, the callback will be triggered multiple times every two seconds

rtcChannel:onNetworkQuality:txQuality:rxQuality

Network upstream and downstream quality report

- (void) rtcChannel:(CloudHubRtcChannelKit * _Nonnull)channel
   onNetworkQuality:(NSString * _Nonnull)uid
          txQuality:(CloudHubNetworkQuality)txQuality
          rxQuality:(CloudHubNetworkQuality)rxQuality;
ParametersDescribe
channelCloudHubRtcChannelKit Instance pointer
uidUser’s uid
txQualitySend quality reports, See CloudHubNetworkQuality
rxQualityReceive quality reports, See CloudHubNetworkQuality

Discussion

This callback describes the statistics about media streams sent and received by a user during a call. Outbound media streams and each remote user media stream are called back separately

rtcChannel:onRtcStats:

Call statistics callback

- (void) rtcChannel:(CloudHubRtcChannelKit * _Nonnull)channel
         onRtcStats:(CloudHubChannelStats * _Nonnull)stats;
ParametersDescribe
channelCloudHubRtcChannelKit Instance pointer
statsStatistics, See CloudHubChannelStats

Discussion

This callback describes the comprehensive statistics of all media streams during a call. It is triggered every 2 seconds

Event for music file playback

rtcChannel:onLocalMovieStateChanged:state:errorCode:

The local user’s music file status changed

- (void)      rtcChannel:(CloudHubRtcChannelKit * _Nonnull)channel
onLocalMovieStateChanged:(NSString * _Nonnull)filepath
                   state:(CloudHubMovieStateCode)state
               errorCode:(CloudHubMovieErrorCode)errorCode;
ParametersDescribe
channelCloudHubRtcChannelKit Instance pointer
filepathThe path to the file passed in when startPlayingMovie:cycle:view:paused: is called
statePlay state, SeeCloudHubMovieStateCode
errorCodeError code, SeeCloudHubMovieErrorCode

rtcChannel:onLocalMovieProgress:pos:total:

Callback of the local user’s music file playing progress

- (void)  rtcChannel:(CloudHubRtcChannelKit * _Nonnull)channel
onLocalMovieProgress:(NSString * _Nonnull)filepath
                 pos:(NSUInteger)pos
               total:(NSUInteger)total;
ParametersDescribe
channelCloudHubRtcChannelKit Instance pointer
filepathThe path to the file passed in when startPlayingMovie:cycle:view:paused: is called
posPlayback Progress (ms)
totalTotal file length (ms)

Local sound file playback Event

rtcChannel:onAudioEffectFinish:

Local user’s sound file playback state change callback

- (void)  rtcChannel:(CloudHubRtcChannelKit * _Nonnull)channel
 onAudioEffectFinish:(int)soundId;
ParametersDescribe
channelCloudHubRtcChannelKit Instance pointer
soundIdThe sound ID passed in at playEffect:filePath:loopCount:pitch:pan:gain:publish:startTimeMS:endTimeMS:

Cross-channel media circulation

rtcChannel:MediaRelayStateChanged:error:

The cross-channel media flow status has changed callback

- (void)    rtcChannel:(CloudHubRtcChannelKit * _Nonnull)channel
MediaRelayStateChanged:(CloudHubMediaRelayState)state
                 error:(CloudHubMediaRelayError)errorr;
ParametersDescribe
channelCloudHubRtcChannelKit Instance pointer
stateCurrent Status: See CloudHubMediaRelayState
CloudHub_RELAY_STATE_IDLE(0): The SDK is initializing
CloudHub_RELAY_STATE_CONNE CTING(1): The SDK tries to cross channels
CloudHub_RELAY_STATE_FAILURE(2): The anchor of the source channel successfully joined the target channel
CloudHub_RELAY_STATE_FAILURE(3): An exception occurs. For details, see the error message in code
errorError code sent across channel media stream: See CloudHubMediaRelayError
CloudHub_RELAY_OK(0):Everything is all right
RELAY_ERROR_SERVER_ERROR_R ESPONSE(1) :Server response error
CloudHub_RELAY_ERROR_SERVER _ERROR_RESPONSE(2) :No response from the server
CloudHub_RELAY_ERROR_NO_RES OURCE_AVAILABLE(3):The SDK fails to obtain services because the server resources are limited
CloudHub_RELAY_ERROR_FAILED_ JOIN_SRC(4):Failed to initiate cross channel forwarding media stream request
CloudHub_RELAY_ERROR_FAILED_ JOIN_DEST(5):Failed to accept the cross channel forwarding media stream request
CloudHub_RELAY_ERROR_FAILED_ PACKET_RECEIVED_FROM_SRC(6):The server failed to receive the media stream forwarded across channels
CloudHub_RELAY_ERROR_FAILED_ PACKET_SENT_TO_DEST(7):The server failed to send cross channel forwarding media stream
CloudHub_RELAY_ERROR_SERVER _CONNECTION_LOST(8):The SDK disconnects from the server due to poor network quality. You can call the leaveChannel: method to leave the current channel

Note:
When the status of cross-channel media flow changes, the SDK triggers this callback and reports the current forwarding status and associated error messages

Advanced Signaling Event

rtcChannel:onSetPropertyOfUid:from:properties:

User - defined property change callback

- (void) rtcChannel:(CloudHubRtcChannelKit * _Nonnull)channel
 onSetPropertyOfUid:(NSString * _Nonnull)uid
               from:(NSString * _Nullable)fromuid
         properties:(NSString * _Nonnull)prop;
ParametersDescribe
channelCloudHubRtcChannelKit Instance pointer
uidThe user UID of the property change
fromuidUid of the user who initiated the operation
propChanged property, JSON string

Note:

The local user will receive this callback only if the local user is within the notification range specified when calling setPropertyOfUid:tell:properties: (If not specified, everyone in the channel will be notified)

rtcChannel:onChatMessageArrival:from:withExtraData:

Chat message callback

- (void)  rtcChannel:(CloudHubRtcChannelKit * _Nonnull)channel
onChatMessageArrival:(NSString * _Nonnull)message
                from:(NSString * _Nullable)fromuid
       withExtraData:(NSString * _Nullable)extraData;
ParametersDescribe
channelCloudHubRtcChannelKit Instance pointer
messageMessage text content
fromuidUid of the user who initiated the operation
extraDataAdditional data, possibly null

Note:

The local user will receive this callback only if the local user is within the notification range specified when calling [sendChatMsg:to:withExtraData:(If not specified, everyone in the channel will be notified)

rtcChannel:onPubMsg:msgId:from:withData:associatedWithUser:associatedWithMsg:ts:withExtraData:isHistory:

Custom message publishing callback

- (void) rtcChannel:(CloudHubRtcChannelKit * _Nonnull)channel
           onPubMsg:(NSString * _Nonnull)msgName
              msgId:(NSString * _Nonnull)msgId
               from:(NSString * _Nullable)fromuid
           withData:(NSString * _Nullable)data
 associatedWithUser:(NSString * _Nullable)uid
  associatedWithMsg:(NSString * _Nullable)assMsgID
                 ts:(NSUInteger)ts
      withExtraData:(NSString * _Nullable)extraData
          isHistory:(BOOL)isHistory;
ParametersDescribe
channelCloudHubRtcChannelKit Instance pointer
msgNameThe name of the message
msgIdA message ID is the unique identifier of a message in a channel
fromuidUid of the message sender
dataMessage content: Must be a JSON string, which can be empty
uidUid of associated user: Once a message is associated with a user, the message is automatically deleted when the user exits
assMsgIDId of associated message: Once a message is associated with another message, this message is automatically deleted when the associated message is deleted
tsThe timestamp of the last time the server received the message
extraDataKeep parameters
isHistoryWhether the message is sent before the local user enters the channel

Note:

Local users will receive this callback only if they are within the notification range specified when calling pubMsg:msgId:to:withData:associatedWithUser:associatedWithMsg:save:extraData: (if not specified, everyone in the channel will be notified)

rtcChannel:onPubMsg:msgId:from:withData:associatedWithUser:associatedWithMsg:ts:withExtraData:isHistory:seq:

Custom message publishing callback

- (void) rtcChannel:(CloudHubRtcChannelKit * _Nonnull)channel
           onPubMsg:(NSString * _Nonnull)msgName
              msgId:(NSString * _Nonnull)msgId
               from:(NSString * _Nullable)fromuid
           withData:(NSString * _Nullable)data
 associatedWithUser:(NSString * _Nullable)uid
  associatedWithMsg:(NSString * _Nullable)assMsgID
                 ts:(NSUInteger)ts
      withExtraData:(NSString * _Nullable)extraData
          isHistory:(BOOL)isHistory
                seq:(NSInteger)seq;
ParametersDescribe
channelCloudHubRtcChannelKit Instance pointer
msgNameThe name of the message
msgIdA message ID is the unique identifier of a message in a channel
fromuidUid of the message sender
dataMessage content: Must be a JSON string, which can be empty
uidUid of associated user: Once a message is associated with a user, the message is automatically deleted when the user exits
assMsgIDId of associated message: Once a message is associated with another message, this message is automatically deleted when the associated message is deleted
tsThe timestamp of the last time the server received the message
extraDataKeep parameters
isHistoryWhether the message is sent before the local user enters the channel
seqSequence in which the server sends messages

Note:

The local user will receive this callback only if the local user is within the notification range specified when calling pubMsg:msgId:to:withData:associatedWithUser:associatedWithMsg:save:extraData: (if not specified, everyone in the channel will be notified)

rtcChannel:onDelMsg:msgId:from:withData:

Custom message deletion callback

- (void) rtcChannel:(CloudHubRtcChannelKit * _Nonnull)channel
           onDelMsg:(NSString * _Nonnull)msgName
              msgId:(NSString * _Nonnull)msgId
               from:(NSString * _Nullable)fromuid
           withData:(NSString * _Nullable)data;
ParametersDescribe
channelCloudHubRtcChannelKit Instance pointer
msgNameThe name of the message
msgIdA message ID is the unique identifier of a message in a channel
fromuidUid of the message sender
dataKeep parameters

Note:

Local users will receive this callback only if they are within the notification range specified when calling delMsg:msgId:to: (If not specified, everyone in the channel will be notified)

rtcChannel:onDelMsg:msgId:from:withData:ts:seq:

Custom message deletion callback

- (void) rtcChannel:(CloudHubRtcChannelKit * _Nonnull)channel
           onDelMsg:(NSString * _Nonnull)msgName
              msgId:(NSString * _Nonnull)msgId
               from:(NSString * _Nullable)fromuid
           withData:(NSString * _Nullable)data
                 ts:(NSUInteger)ts
                seq:(NSInteger)seq;
ParametersDescribe
channelCloudHubRtcChannelKit Instance pointer
msgNameThe name of the message
msgIdA message ID is the unique identifier of a message in a channel
fromuidUid of the message sender
dataKeep parameters
tsMessage sending time
seqSequence in which the server sends messages

Note:

Local users will receive this callback only if they are within the notification range specified when calling delMsg:msgId:to: (If not specified, everyone in the channel will be notified)

rtcChannel:onLocalUserEvicted:

Local user kicked out of channel callback

- (void) rtcChannel:(CloudHubRtcChannelKit * _Nonnull)channel
 onLocalUserEvicted:(NSInteger)reason;
ParametersDescribe
channelCloudHubRtcChannelKit Instance pointer
reasonKicked cause: Filled in by the server, or passed in when calling evictUser:reason: , see details below

Discussion

When this callback is received, there are two possible reasons:

rtcChannelOnHistoryDataReady:

Callback after sending history signaling

- (void) rtcChannelOnHistoryDataReady:(CloudHubRtcChannelKit * _Nonnull)channel;
ParametersDescribe
channelCloudHubRtcChannelKit Instance pointer

Discussion

When the historical signaling saved by the server is sent, the SDK triggers the callback