I am working on video call app using Apprtc.Follow below mention libraries.
When I change url to my custom server instead of apprtc server then video call is disconnected after 1 minute. I have lost connection with server.
To avoid the connection lost with server, we need to ping server in regular interval approx 30 sec.
But above mention AppRTC project are using jar file(autobanh.jar) to websocket connection, but in library sendPing mentod is private so not accessible.
Question 1 - There is nay way to ping websocket server.
Try after replace websocet library I had changed websocket library with below mention libraries
After recplacing websocket library, Now I am able to access sendPing method. But still I have connection lost after 60 seconds during video call.
Ping Method-
public void sendPingMessageToServer() {
try {
WebSocketMessage.Ping ping = new WebSocketMessage.Ping();
// ping.mPayload="ping to server".getBytes();
mWebSocketWriter.sendPing(ping);
} catch (Exception e) {
e.printStackTrace();
}
}
When in uncomment ping.mPayload line then I get BufferOverflowException.
Timer of 30 seconds
private void startConnectionCheckTimer() {
timerInstance.scheduleAtFixedRate(new TimerTask() {
@Override
public void run() {
try {
ws.sendPingMessageToServer();
} catch (Exception e) {
e.printStackTrace();
}
}
}, 0, 30 * 1000);
}
Please suggest how to avoid call disconnection after 60 seconds.
I had changed the websocket library to https://github.com/crossbario/autobahn-java
This library has functionality of auto ping to server on regular time interval. After adding it, i have modified only one class of ApprtcDemo- WebSocketChannelClient
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With