I'm testing code very similar to what is in the Autobahn documentation for subscribing to a PubSub topic using AutobahnConnection(). My connection works great and I get the data back from my event handler just fine. However, the connection is timing out after a few minutes. How do I get the WebSocket options into the connection so I can increase/remove the connection timeout or is it better to just ping the server every 30 seconds from the client to keep the connection alive? Thanks in advance for any help!!
final AutobahnConnection mConnection = new AutobahnConnection();
private void connectToServer() {
WebSocketOptions options = new WebSocketOptions();
options.setSocketConnectTimeout(0);
mConnection.connect(wsuri, new Autobahn.SessionHandler() {
@Override
public void onOpen() {
Log.d(TAG, "Status: Connected to " + wsuri);
connectRealTimeServer();
}
@Override
public void onClose(int code, String reason) {
Log.d(TAG, "Connection lost: Code: "+code+" Reason:" + reason);
}
});
} ....