Closed lujx1024 closed 4 years ago
Thanks for reporting that issue. Can you check which version of autobahn-android
you are using ? Looking at the stacktrace it seems you might be using an old version of the library. That specific issue that you reported was most likely fixed by https://github.com/crossbario/autobahn-java/pull/473/files
Version 20.2.1
fixed that issue. Please add that line to your project's gradle config.
implementation 'io.crossbar.autobahn:autobahn-android:20.2.1'
thanks for your advise ,I used the 20.1.1 version I read from README file,after I change to 20.2.1,I got an onClose callback and a close reason matched CLOSE_CANNOT_CONNECT defined at the IWebSocketConnectionHandler. well , this may cause another problem, in this circumstance,normally I should wait some time and recall the connect method scheduled until the server is completely initialized and running. I tryed this way,but at the third time the client established the connection , the app crashed again,and this is the crash log
java.util.concurrent.RejectedExecutionException: Task java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask@31a18629 rejected from java.util.concurrent.ScheduledThreadPoolExecutor@55ccdae[Terminated, pool size = 0, active threads = 0, queued tasks = 0, completed tasks = 1] at java.util.concurrent.ThreadPoolExecutor$AbortPolicy.rejectedExecution(ThreadPoolExecutor.java:2011) at java.util.concurrent.ThreadPoolExecutor.reject(ThreadPoolExecutor.java:793) at java.util.concurrent.ScheduledThreadPoolExecutor.delayedExecute(ScheduledThreadPoolExecutor.java:298) at java.util.concurrent.ScheduledThreadPoolExecutor.scheduleAtFixedRate(ScheduledThreadPoolExecutor.java:543) at java.util.concurrent.Executors$DelegatedScheduledExecutorService.scheduleAtFixedRate(Executors.java:650) at io.crossbar.autobahn.websocket.WebSocketConnection.setOptions(WebSocketConnection.java:531) at com.aoto.interaction.service.WebSocketClientService.initWebSocket(WebSocketClientService.java:94) at com.aoto.interaction.service.WebSocketClientService.connect(WebSocketClientService.java:210) at com.aoto.interaction.InteractionWebSocketClient.connect(InteractionWebSocketClient.java:113) at com.aoto.rd.voice.MainActivity$2.onClick(MainActivity.java:96) at android.view.View.performClick(View.java:4813) at android.view.View$PerformClick.run(View.java:20015) at android.os.Handler.handleCallback(Handler.java:739) at android.os.Handler.dispatchMessage(Handler.java:95) at android.os.Looper.loop(Looper.java:135) at android.app.ActivityThread.main(ActivityThread.java:5280) at java.lang.reflect.Method.invoke(Native Method) at java.lang.reflect.Method.invoke(Method.java:372) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:963) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:758)
so, would you please tell me if I call reconnect method wrong ? or what is your suggestion to do that, anthing will be appreciated,and thanks again for you reply
i avoid this error by use some strateges,thanks for your support
Here is the problem I encountered,when I try to established a connect to the websocket server,of course the client app runs on android,I have read all the issues and googleed for answer ,found nothing ,the connect code like this
when the server is not initialized or the host url is wrong(but is a valid url),the app is crashed,and the crash reason is NullPointException,like this
I don't know if it is a bug or just me use it not correctly.if this is a bug,please fix it ,or please tell me how to use it correctly, I will be very appreciated