I am working on an app for android which involves Quickblox. I am keep getting message 'Chat connection has been dropped'. Upon reading the logcat, this is what I am getting:
12-08 11:15:31.214 13894-14722/com.quickblox.sample W/AbstractXMPPConnection: Connection closed with error java.net.SocketTimeoutException: Read timed out at com.android.org.conscrypt.NativeCrypto.SSL_read(Native Method) at com.android.org.conscrypt.OpenSSLSocketImpl$SSLInputStream.read(OpenSSLSocketImpl.java:705) at java.io.InputStreamReader.read(InputStreamReader.java:233) at java.io.BufferedReader.read(BufferedReader.java:325) at org.jivesoftware.smack.util.ObservableReader.read(SourceFile:41) at org.kxml2.io.KXmlParser.fillBuffer(KXmlParser.java:1515) at org.kxml2.io.KXmlParser.peekType(KXmlParser.java:992) at org.kxml2.io.KXmlParser.next(KXmlParser.java:349) at org.kxml2.io.KXmlParser.next(KXmlParser.java:313) at org.jivesoftware.smack.tcp.XMPPTCPConnection$PacketReader.parsePackets(SourceFile:1240) at org.jivesoftware.smack.tcp.XMPPTCPConnection$PacketReader.access$300(SourceFile:1014) at org.jivesoftware.smack.tcp.XMPPTCPConnection$PacketReader$1.run(SourceFile:1029) at java.lang.Thread.run(Thread.java:818) 12-08 11:15:31.216 13894-14722/com.quickblox.sample D/SMACK: XMPPConnection closed due to an exception (0) 12-08 11:15:31.216 13894-14722/com.quickblox.sample W/System.err: java.net.SocketTimeoutException: Read timed out 12-08 11:15:31.216 13894-14722/com.quickblox.sample W/System.err: at com.android.org.conscrypt.NativeCrypto.SSL_read(Native Method) 12-08 11:15:31.216 13894-14722/com.quickblox.sample W/System.err: at com.android.org.conscrypt.OpenSSLSocketImpl$SSLInputStream.read(OpenSSLSocketImpl.java:705) 12-08 11:15:31.216 13894-14722/com.quickblox.sample W/System.err: at java.io.InputStreamReader.read(InputStreamReader.java:233) 12-08 11:15:31.216 13894-14722/com.quickblox.sample W/System.err: at java.io.BufferedReader.read(BufferedReader.java:325) 12-08 11:15:31.216 13894-14722/com.quickblox.sample W/System.err: at org.jivesoftware.smack.util.ObservableReader.read(SourceFile:41) 12-08 11:15:31.216 13894-14722/com.quickblox.sample W/System.err: at org.kxml2.io.KXmlParser.fillBuffer(KXmlParser.java:1515) 12-08 11:15:31.216 13894-14722/com.quickblox.sample W/System.err: at org.kxml2.io.KXmlParser.peekType(KXmlParser.java:992) 12-08 11:15:31.216 13894-14722/com.quickblox.sample W/System.err: at org.kxml2.io.KXmlParser.next(KXmlParser.java:349) 12-08 11:15:31.216 13894-14722/com.quickblox.sample W/System.err: at org.kxml2.io.KXmlParser.next(KXmlParser.java:313) 12-08 11:15:31.216 13894-14722/com.quickblox.sample W/System.err: at org.jivesoftware.smack.tcp.XMPPTCPConnection$PacketReader.parsePackets(SourceFile:1240) 12-08 11:15:31.216 13894-14722/com.quickblox.sample W/System.err: at org.jivesoftware.smack.tcp.XMPPTCPConnection$PacketReader.access$300(SourceFile:1014) 12-08 11:15:31.217 13894-14722/com.quickblox.sample W/System.err: at org.jivesoftware.smack.tcp.XMPPTCPConnection$PacketReader$1.run(SourceFile:1029) 12-08 11:15:31.217 13894-13894/com.quickblox.sample I/VerboseQbChatConnectionListener: connectionClosedOnError(): Read timed out 12-08 11:15:31.217 13894-14722/com.quickblox.sample W/System.err: at java.lang.Thread.run(Thread.java:818)
I am not able to find a solution for the same.
A socket is what you use to communicate over a network (for example to connect to a server on the Internet). The error message means that a program was trying to receive data from a remote computer over the network, but no no data was received for a period of time, so the program stopped waiting for the data to be received.
Here is the code snippet which may solve this problem by increasing Socket Timeout as default SocketTimeOut in Quickblox is 30 seconds.
QBChatService.ConfigurationBuilder chatServiceConfigurationBuilder = new QBChatService.ConfigurationBuilder();
chatServiceConfigurationBuilder.setSocketTimeout(180); //Sets chat socket's read timeout in seconds
chatServiceConfigurationBuilder.setKeepAlive(true); //Sets connection socket's keepAlive option.
QBChatService.setConfigurationBuilder(chatServiceConfigurationBuilder);