Manish Pathak
Manish Pathak

Reputation: 3304

webRTC appRTC , connection is getting automatically terminated between a call after a interval of approx 2 mins (ISBX demo)

I am using a git library from ISBX and integrated video calling feature in my swift application all is working okay Its just a major blocker is after 2 minutes of time approx the connection gets automatically terminated with the following error:-

WebSocket closed with code: 1001 reason:Stream end encountered wasClean:0

Detailed error

2016-07-18 12:44:20.687 testOttaApp-QA[527:74428] WebSocket closed with code: 1001 reason:Stream end encountered wasClean:0

2016-07-18 12:44:20.687 testOttaApp-QA[527:74428] C->RS: BYE

2016-07-18 12:44:20.687 testOttaApp-QA[527:74428] url = https://apprtc.appspot.com/leave/ootaTest82/54508636

2016-07-18 07:14:21.503 testOttaApp-QA[527:16e893000] INFO MMINTEGRATION CMediaPlatformWrapper.cpp:937

CMediaPlatformWrapper::DevicePropertyChanged called

2016-07-18 07:14:21.504 testOttaApp-QA[527:16e893000] INFO MMINTEGRATION CMediaPlatformWrapper.cpp:969 CMediaCallWrapper::fireMediaPlatformEvent() called with type 4 Disconnected!

2016-07-18 07:14:21.514 testOttaApp-QA[527:1a05f7000] INFO APPLICATION CUcmpConversationsManager.cpp:2348 CUcmpConversationsManager::onEvent(). EventType: 4

2016-07-18 12:44:22.989 testOttaApp-QA[527:74428] Unregistered from room server.

Upvotes: 1

Views: 942

Answers (1)

Manish Pathak
Manish Pathak

Reputation: 3304

Finally one of my developer resolved this issue.

In ARDWebSocketChannel.m class he has constantly doing a ping to server to avoid any break in connection.

#pragma mark - SRWebSocketDelegate

- (void)webSocketDidOpen:(SRWebSocket *)webSocket {
    NSLog(@"WebSocket connection opened.");
    self.state = kARDWebSocketChannelStateOpen;
    if (_roomId.length && _clientId.length) {
        [self registerWithCollider];
        // Sending autoping to server
        [self startConnectionCheckTimer];
    }
}

// Checking for WSconnection by Sending Scheduled Ping
- (void)startConnectionCheckTimer {
    if (!_timer) {
        _timer = [NSTimer scheduledTimerWithTimeInterval:30.0f
                                                  target:self
                                                selector:@selector(sendPing:)
                                                userInfo:nil
                                                 repeats:YES];
    }
}

- (void)stopConnectionCheckTimer {
    if ([_timer isValid]) {
        [_timer invalidate];
    }
    _timer = nil;
}

- (void)sendPing:(id)sender
{
    if(_socket != nil)
    {

            [_socket sendPing:nil];

    }
}

Upvotes: 2

Related Questions