I am using ISBX/apprtc-ios code for video chat implementation. This work perfect in iPhone and simulator. I want to send text/string data between two peers and I am using
I am able to send data through RTCDataChannel. What I did is before sending the offer. I created the RTCDataChannelInit with the below configuration.
RTCDataChannelInit *datainit = [[RTCDataChannelInit alloc] init];
datainit.isNegotiated = YES;
datainit.isOrdered = YES;
datainit.maxRetransmits = 30;
datainit.maxRetransmitTimeMs = 30000;
datainit.streamId = 1;
self.dataChannel = [_peerConnection createDataChannelWithLabel:@"commands" config:datainit];
self.dataChannel.delegate=self;
Once both the devices get connected, I checked the state in the delegate function. The state of the channel is open.
- (void)channelDidChangeState:(RTCDataChannel*)channel
{
NSLog(@"channel.state %u",channel.state);
}
Then I send the data as per the below code:
RTCDataBuffer *buffer = [[RTCDataBuffer alloc] initWithData:[str dataUsingEncoding:NSUTF8StringEncoding] isBinary:NO];
BOOL x = [self.dataChannel sendData:buffer];
The configuration I used was given here: https://groups.google.com/forum/#!searchin/discuss-webrtc/RTCDataChannel/discuss-webrtc/9NObqxnItCg/mRvXBIwkA7wJ