-
Notifications
You must be signed in to change notification settings - Fork 2
DataChannel
Lejla Solak edited this page Sep 30, 2025
·
2 revisions
dataChannelEventListener: DataChannelEventListener?send(text: String, _ completionHandler: @escaping (String?, ErrorCode?) -> Void))send(text: String, to: Endpoint, _ completionHandler: @escaping (String?, ErrorCode?) -> Void))
Configures the event handler for data channel events.
let applicationCall = getInfobipRTCInstance().getActiveApplicationCall()
applicationCall?.dataChannel()?.dataChannelEventListener = selfSends data through the data channel to other call participants who have enabled the use of the data channel.
-
text:String- Data to be sent through the data channel. -
completionHandler:(String?, ErrorCode?) -> Void- Completion handler optionally receiving an ID of the sent text or anErrorCodein case the sending is unsuccessful.
N/A
let infobipRTC = getInfobipRTCInstance()
if let call = infobipRTC.getActiveRoomCall() as? RoomCall {
call.send(text: "Hello World!") { id, errorCode in
if let errorCode = errorCode {
print("An error has occurred: \(errorCode.description)")
}
}
}Directly sends data through the data channel to a chosen endpoint participating in a call. This method ensures that the text is only sent to the chosen recipient and therefore is not received by other call participants.
-
text:String- Data to be sent through the data channel. -
to:Endpoint- Endpoint to which data is to be sent directly. -
completionHandler:(String?, ErrorCode?) -> Void- Completion handler optionally receiving an ID of the text which was sent or anErrorCodein case the sending is unsuccessful.
N/A
let infobipRTC = getInfobipRTCInstance()
if let call = infobipRTC.getActiveCall() as? WebrtcCall {
call.send(text: "Hello", to: call.counterpart()) { id, errorCode in
if let errorCode = errorCode {
print("An error has occurred: \(errorCode.description)")
}
}
}