B4J Question How to create a WebSocketClient that accepts all certificates

kostefar

Active Member
Licensed User
Dear All,

As requested by Erel in: https://www.b4x.com/android/forum/threads/retrieving-websocket-data-from-webview.88748/#post-562332

.. here´s a new thread on this topic.
Issue: the WebSocketClient library in b4j does not have an option to bypass certificate security check as it´s the case with b4a´s websocket implementation, where the following solves the problem:

B4X:
Dim ws1 As WebSocket
    Dim cs As CustomTrustManager
    cs.InitializeAcceptAll
    ws1.Initialize("ws")
    ws1.SetCustomSSLTrustManager(cs)

I´m looking for a way to do the same in b4j.

Thanks in advance for any suggestion!
 

Erel

Administrator
Staff member
Licensed User
Complete example:
B4X:
Sub Process_Globals
   Private fx As JFX
   Private MainForm As Form
   Private ws As WebSocketClient
End Sub

Sub AppStart (Form1 As Form, Args() As String)
   MainForm = Form1
   MainForm.Show
   
   ws.Initialize("ws")
   'accept all trust manager
   Dim ssl As JavaObject
   ssl.InitializeNewInstance("org.eclipse.jetty.util.ssl.SslContextFactory", Array(True))
   Dim jo As JavaObject = ws
   Dim wsc As JavaObject
   wsc.InitializeNewInstance("org.eclipse.jetty.websocket.client.WebSocketClient", Array(ssl))
   jo.SetField("wsc", wsc)
   
   ws.Connect("wss://b4x.com:51041/smiley/ws")
   Wait For ws_Connected
   Log("connected")
   
End Sub

I haven't tested it with a self signed certificate.
 
Upvote 0

kostefar

Active Member
Licensed User
Complete example:
B4X:
Sub Process_Globals
   Private fx As JFX
   Private MainForm As Form
   Private ws As WebSocketClient
End Sub

Sub AppStart (Form1 As Form, Args() As String)
   MainForm = Form1
   MainForm.Show
  
   ws.Initialize("ws")
   'accept all trust manager
   Dim ssl As JavaObject
   ssl.InitializeNewInstance("org.eclipse.jetty.util.ssl.SslContextFactory", Array(True))
   Dim jo As JavaObject = ws
   Dim wsc As JavaObject
   wsc.InitializeNewInstance("org.eclipse.jetty.websocket.client.WebSocketClient", Array(ssl))
   jo.SetField("wsc", wsc)
  
   ws.Connect("wss://b4x.com:51041/smiley/ws")
   Wait For ws_Connected
   Log("connected")
  
End Sub

I haven't tested it with a self signed certificate.


Thanks Erel so much, it works! Should I ever bounce into you, remind me that I´m in debt of a bottle of whiskey to you for this :)
 
Upvote 0

kostefar

Active Member
Licensed User
Ok, so it does work, but not without glitches.

However, I get various errors at random times. For example:

B4X:
org.eclipse.jetty.websocket.api.UpgradeException: 0 null
    at org.eclipse.jetty.websocket.client.WebSocketUpgradeRequest.onComplete(WebSocketUpgradeRequest.java:513)
    at org.eclipse.jetty.client.ResponseNotifier.notifyComplete(ResponseNotifier.java:193)
    at org.eclipse.jetty.client.ResponseNotifier.notifyComplete(ResponseNotifier.java:185)
    at org.eclipse.jetty.client.HttpReceiver.terminateResponse(HttpReceiver.java:459)
    at org.eclipse.jetty.client.HttpReceiver.abort(HttpReceiver.java:540)
    at org.eclipse.jetty.client.HttpChannel.abortResponse(HttpChannel.java:129)
    at org.eclipse.jetty.client.HttpChannel.abort(HttpChannel.java:122)
    at org.eclipse.jetty.client.HttpExchange.abort(HttpExchange.java:257)
    at org.eclipse.jetty.client.HttpConversation.abort(HttpConversation.java:141)
    at org.eclipse.jetty.client.HttpRequest.abort(HttpRequest.java:748)
    at org.eclipse.jetty.client.http.HttpConnectionOverHTTP.abort(HttpConnectionOverHTTP.java:166)
    at org.eclipse.jetty.client.http.HttpConnectionOverHTTP.close(HttpConnectionOverHTTP.java:152)
    at org.eclipse.jetty.client.http.HttpConnectionOverHTTP.close(HttpConnectionOverHTTP.java:143)
    at java.util.ArrayList.forEach(ArrayList.java:1249)
    at org.eclipse.jetty.client.AbstractConnectionPool.close(AbstractConnectionPool.java:191)
    at org.eclipse.jetty.client.DuplexConnectionPool.close(DuplexConnectionPool.java:233)
    at org.eclipse.jetty.client.HttpDestination.close(HttpDestination.java:368)
    at org.eclipse.jetty.client.HttpClient.doStop(HttpClient.java:248)
    at org.eclipse.jetty.util.component.AbstractLifeCycle.stop(AbstractLifeCycle.java:89)
    at org.eclipse.jetty.util.component.ContainerLifeCycle.stop(ContainerLifeCycle.java:142)
    at org.eclipse.jetty.util.component.ContainerLifeCycle.doStop(ContainerLifeCycle.java:160)
    at org.eclipse.jetty.websocket.client.WebSocketClient.doStop(WebSocketClient.java:401)
    at org.eclipse.jetty.util.component.AbstractLifeCycle.stop(AbstractLifeCycle.java:89)
    at anywhersoftware.b4j.objects.WebSocketClientWrapper$2.run(WebSocketClientWrapper.java:83)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)
Caused by: java.nio.channels.AsynchronousCloseException
    ... 17 more
org.eclipse.jetty.websocket.api.UpgradeException: 0 null
    at org.eclipse.jetty.websocket.client.WebSocketUpgradeRequest.onComplete(WebSocketUpgradeRequest.java:520)
    at org.eclipse.jetty.client.ResponseNotifier.notifyComplete(ResponseNotifier.java:193)
    at org.eclipse.jetty.client.ResponseNotifier.notifyComplete(ResponseNotifier.java:185)
    at org.eclipse.jetty.client.HttpReceiver.terminateResponse(HttpReceiver.java:459)
    at org.eclipse.jetty.client.HttpReceiver.abort(HttpReceiver.java:540)
    at org.eclipse.jetty.client.HttpChannel.abortResponse(HttpChannel.java:129)
    at org.eclipse.jetty.client.HttpChannel.abort(HttpChannel.java:122)
    at org.eclipse.jetty.client.HttpExchange.abort(HttpExchange.java:257)
    at org.eclipse.jetty.client.HttpConversation.abort(HttpConversation.java:141)
    at org.eclipse.jetty.client.HttpRequest.abort(HttpRequest.java:748)
    at org.eclipse.jetty.client.http.HttpConnectionOverHTTP.abort(HttpConnectionOverHTTP.java:166)
    at org.eclipse.jetty.client.http.HttpConnectionOverHTTP.close(HttpConnectionOverHTTP.java:152)
    at org.eclipse.jetty.client.http.HttpConnectionOverHTTP.close(HttpConnectionOverHTTP.java:143)
    at java.util.ArrayList.forEach(ArrayList.java:1249)
    at org.eclipse.jetty.client.AbstractConnectionPool.close(AbstractConnectionPool.java:191)
    at org.eclipse.jetty.client.DuplexConnectionPool.close(DuplexConnectionPool.java:233)
    at org.eclipse.jetty.client.HttpDestination.close(HttpDestination.java:368)
    at org.eclipse.jetty.client.HttpClient.doStop(HttpClient.java:248)
    at org.eclipse.jetty.util.component.AbstractLifeCycle.stop(AbstractLifeCycle.java:89)
    at org.eclipse.jetty.util.component.ContainerLifeCycle.stop(ContainerLifeCycle.java:142)
    at org.eclipse.jetty.util.component.ContainerLifeCycle.doStop(ContainerLifeCycle.java:160)
    at org.eclipse.jetty.websocket.client.WebSocketClient.doStop(WebSocketClient.java:401)
    at org.eclipse.jetty.util.component.AbstractLifeCycle.stop(AbstractLifeCycle.java:89)
    at anywhersoftware.b4j.objects.WebSocketClientWrapper$2.run(WebSocketClientWrapper.java:83)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)
java.util.concurrent.ExecutionException: org.eclipse.jetty.websocket.api.UpgradeException: 0 null
    at java.util.concurrent.CompletableFuture.reportGet(CompletableFuture.java:357)
    at java.util.concurrent.CompletableFuture.get(CompletableFuture.java:1895)
    at anywhersoftware.b4j.objects.WebSocketClientWrapper.Close(WebSocketClientWrapper.java:76)
    at anywhersoftware.b4j.objects.WebSocketClientWrapper$WSHandler.onWebSocketError(WebSocketClientWrapper.java:118)
    at org.eclipse.jetty.websocket.common.events.JettyListenerEventDriver.onError(JettyListenerEventDriver.java:112)
    at org.eclipse.jetty.websocket.common.events.AbstractEventDriver.incomingError(AbstractEventDriver.java:96)
    at org.eclipse.jetty.websocket.client.WebSocketUpgradeRequest.handleException(WebSocketUpgradeRequest.java:526)
    at org.eclipse.jetty.websocket.client.WebSocketUpgradeRequest.onComplete(WebSocketUpgradeRequest.java:520)
    at org.eclipse.jetty.client.ResponseNotifier.notifyComplete(ResponseNotifier.java:193)
    at org.eclipse.jetty.client.ResponseNotifier.notifyComplete(ResponseNotifier.java:185)
    at org.eclipse.jetty.client.HttpReceiver.terminateResponse(HttpReceiver.java:459)
    at org.eclipse.jetty.client.HttpReceiver.abort(HttpReceiver.java:540)
    at org.eclipse.jetty.client.HttpChannel.abortResponse(HttpChannel.java:129)
    at org.eclipse.jetty.client.HttpChannel.abort(HttpChannel.java:122)
    at org.eclipse.jetty.client.HttpExchange.abort(HttpExchange.java:257)
    at org.eclipse.jetty.client.HttpConversation.abort(HttpConversation.java:141)
    at org.eclipse.jetty.client.HttpRequest.abort(HttpRequest.java:748)
    at org.eclipse.jetty.client.http.HttpConnectionOverHTTP.abort(HttpConnectionOverHTTP.java:166)
    at org.eclipse.jetty.client.http.HttpConnectionOverHTTP.close(HttpConnectionOverHTTP.java:152)
    at org.eclipse.jetty.client.http.HttpConnectionOverHTTP.close(HttpConnectionOverHTTP.java:143)
    at java.util.ArrayList.forEach(ArrayList.java:1249)
    at org.eclipse.jetty.client.AbstractConnectionPool.close(AbstractConnectionPool.java:191)
    at org.eclipse.jetty.client.DuplexConnectionPool.close(DuplexConnectionPool.java:233)
    at org.eclipse.jetty.client.HttpDestination.close(HttpDestination.java:368)
    at org.eclipse.jetty.client.HttpClient.doStop(HttpClient.java:248)
    at org.eclipse.jetty.util.component.AbstractLifeCycle.stop(AbstractLifeCycle.java:89)
    at org.eclipse.jetty.util.component.ContainerLifeCycle.stop(ContainerLifeCycle.java:142)
    at org.eclipse.jetty.util.component.ContainerLifeCycle.doStop(ContainerLifeCycle.java:160)
    at org.eclipse.jetty.websocket.client.WebSocketClient.doStop(WebSocketClient.java:401)
    at org.eclipse.jetty.util.component.AbstractLifeCycle.stop(AbstractLifeCycle.java:89)
    at anywhersoftware.b4j.objects.WebSocketClientWrapper$2.run(WebSocketClientWrapper.java:83)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)
Caused by: org.eclipse.jetty.websocket.api.UpgradeException: 0 null
    at org.eclipse.jetty.websocket.client.WebSocketUpgradeRequest.onComplete(WebSocketUpgradeRequest.java:513)
    ... 28 more
Caused by: java.nio.channels.AsynchronousCloseException
    ... 17 more
ws Connecting
ws error: 0 null
org.eclipse.jetty.websocket.api.UpgradeException: 0 null
    at org.eclipse.jetty.websocket.client.WebSocketUpgradeRequest.onComplete(WebSocketUpgradeRequest.java:513)
    at org.eclipse.jetty.client.ResponseNotifier.notifyComplete(ResponseNotifier.java:193)
    at org.eclipse.jetty.client.ResponseNotifier.notifyComplete(ResponseNotifier.java:185)
    at org.eclipse.jetty.client.HttpReceiver.terminateResponse(HttpReceiver.java:459)
    at org.eclipse.jetty.client.HttpReceiver.abort(HttpReceiver.java:540)
    at org.eclipse.jetty.client.HttpChannel.abortResponse(HttpChannel.java:129)
    at org.eclipse.jetty.client.HttpChannel.abort(HttpChannel.java:122)
    at org.eclipse.jetty.client.HttpExchange.abort(HttpExchange.java:257)
    at org.eclipse.jetty.client.HttpConversation.abort(HttpConversation.java:141)
    at org.eclipse.jetty.client.HttpRequest.abort(HttpRequest.java:748)
    at org.eclipse.jetty.client.http.HttpConnectionOverHTTP.abort(HttpConnectionOverHTTP.java:166)
    at org.eclipse.jetty.client.http.HttpConnectionOverHTTP.close(HttpConnectionOverHTTP.java:152)
    at org.eclipse.jetty.client.http.HttpConnectionOverHTTP.close(HttpConnectionOverHTTP.java:143)
    at java.util.ArrayList.forEach(ArrayList.java:1249)
    at org.eclipse.jetty.client.AbstractConnectionPool.close(AbstractConnectionPool.java:191)
    at org.eclipse.jetty.client.DuplexConnectionPool.close(DuplexConnectionPool.java:233)
    at org.eclipse.jetty.client.HttpDestination.close(HttpDestination.java:368)
    at org.eclipse.jetty.client.HttpClient.doStop(HttpClient.java:248)
    at org.eclipse.jetty.util.component.AbstractLifeCycle.stop(AbstractLifeCycle.java:89)
    at org.eclipse.jetty.util.component.ContainerLifeCycle.stop(ContainerLifeCycle.java:142)
    at org.eclipse.jetty.util.component.ContainerLifeCycle.doStop(ContainerLifeCycle.java:160)
    at org.eclipse.jetty.websocket.client.WebSocketClient.doStop(WebSocketClient.java:401)
    at org.eclipse.jetty.util.component.AbstractLifeCycle.stop(AbstractLifeCycle.java:89)
    at anywhersoftware.b4j.objects.WebSocketClientWrapper$2.run(WebSocketClientWrapper.java:83)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)
Caused by: java.nio.channels.AsynchronousCloseException
    ... 17 more
org.eclipse.jetty.websocket.api.UpgradeException: 0 null
    at org.eclipse.jetty.websocket.client.WebSocketUpgradeRequest.onComplete(WebSocketUpgradeRequest.java:520)
    at org.eclipse.jetty.client.ResponseNotifier.notifyComplete(ResponseNotifier.java:193)
    at org.eclipse.jetty.client.ResponseNotifier.notifyComplete(ResponseNotifier.java:185)
    at org.eclipse.jetty.client.HttpReceiver.terminateResponse(HttpReceiver.java:459)
    at org.eclipse.jetty.client.HttpReceiver.abort(HttpReceiver.java:540)
    at org.eclipse.jetty.client.HttpChannel.abortResponse(HttpChannel.java:129)
    at org.eclipse.jetty.client.HttpChannel.abort(HttpChannel.java:122)
    at org.eclipse.jetty.client.HttpExchange.abort(HttpExchange.java:257)
    at org.eclipse.jetty.client.HttpConversation.abort(HttpConversation.java:141)
    at org.eclipse.jetty.client.HttpRequest.abort(HttpRequest.java:748)
    at org.eclipse.jetty.client.http.HttpConnectionOverHTTP.abort(HttpConnectionOverHTTP.java:166)
    at org.eclipse.jetty.client.http.HttpConnectionOverHTTP.close(HttpConnectionOverHTTP.java:152)
    at org.eclipse.jetty.client.http.HttpConnectionOverHTTP.close(HttpConnectionOverHTTP.java:143)
    at java.util.ArrayList.forEach(ArrayList.java:1249)
    at org.eclipse.jetty.client.AbstractConnectionPool.close(AbstractConnectionPool.java:191)
    at org.eclipse.jetty.client.DuplexConnectionPool.close(DuplexConnectionPool.java:233)
    at org.eclipse.jetty.client.HttpDestination.close(HttpDestination.java:368)
    at org.eclipse.jetty.client.HttpClient.doStop(HttpClient.java:248)
    at org.eclipse.jetty.util.component.AbstractLifeCycle.stop(AbstractLifeCycle.java:89)
    at org.eclipse.jetty.util.component.ContainerLifeCycle.stop(ContainerLifeCycle.java:142)
    at org.eclipse.jetty.util.component.ContainerLifeCycle.doStop(ContainerLifeCycle.java:160)
    at org.eclipse.jetty.websocket.client.WebSocketClient.doStop(WebSocketClient.java:401)
    at org.eclipse.jetty.util.component.AbstractLifeCycle.stop(AbstractLifeCycle.java:89)
    at anywhersoftware.b4j.objects.WebSocketClientWrapper$2.run(WebSocketClientWrapper.java:83)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)
java.util.concurrent.ExecutionException: org.eclipse.jetty.websocket.api.UpgradeException: 0 null
    at java.util.concurrent.CompletableFuture.reportGet(CompletableFuture.java:357)
    at java.util.concurrent.CompletableFuture.get(CompletableFuture.java:1895)
    at anywhersoftware.b4j.objects.WebSocketClientWrapper.Close(WebSocketClientWrapper.java:76)
    at anywhersoftware.b4j.objects.WebSocketClientWrapper$WSHandler.onWebSocketError(WebSocketClientWrapper.java:118)
    at org.eclipse.jetty.websocket.common.events.JettyListenerEventDriver.onError(JettyListenerEventDriver.java:112)
    at org.eclipse.jetty.websocket.common.events.AbstractEventDriver.incomingError(AbstractEventDriver.java:96)
    at org.eclipse.jetty.websocket.client.WebSocketUpgradeRequest.handleException(WebSocketUpgradeRequest.java:526)
    at org.eclipse.jetty.websocket.client.WebSocketUpgradeRequest.onComplete(WebSocketUpgradeRequest.java:520)
    at org.eclipse.jetty.client.ResponseNotifier.notifyComplete(ResponseNotifier.java:193)
    at org.eclipse.jetty.client.ResponseNotifier.notifyComplete(ResponseNotifier.java:185)
    at org.eclipse.jetty.client.HttpReceiver.terminateResponse(HttpReceiver.java:459)
    at org.eclipse.jetty.client.HttpReceiver.abort(HttpReceiver.java:540)
    at org.eclipse.jetty.client.HttpChannel.abortResponse(HttpChannel.java:129)
    at org.eclipse.jetty.client.HttpChannel.abort(HttpChannel.java:122)
    at org.eclipse.jetty.client.HttpExchange.abort(HttpExchange.java:257)
    at org.eclipse.jetty.client.HttpConversation.abort(HttpConversation.java:141)
    at org.eclipse.jetty.client.HttpRequest.abort(HttpRequest.java:748)
    at org.eclipse.jetty.client.http.HttpConnectionOverHTTP.abort(HttpConnectionOverHTTP.java:166)
    at org.eclipse.jetty.client.http.HttpConnectionOverHTTP.close(HttpConnectionOverHTTP.java:152)
    at org.eclipse.jetty.client.http.HttpConnectionOverHTTP.close(HttpConnectionOverHTTP.java:143)
    at java.util.ArrayList.forEach(ArrayList.java:1249)
    at org.eclipse.jetty.client.AbstractConnectionPool.close(AbstractConnectionPool.java:191)
    at org.eclipse.jetty.client.DuplexConnectionPool.close(DuplexConnectionPool.java:233)
    at org.eclipse.jetty.client.HttpDestination.close(HttpDestination.java:368)
    at org.eclipse.jetty.client.HttpClient.doStop(HttpClient.java:248)
    at org.eclipse.jetty.util.component.AbstractLifeCycle.stop(AbstractLifeCycle.java:89)
    at org.eclipse.jetty.util.component.ContainerLifeCycle.stop(ContainerLifeCycle.java:142)
    at org.eclipse.jetty.util.component.ContainerLifeCycle.doStop(ContainerLifeCycle.java:160)
    at org.eclipse.jetty.websocket.client.WebSocketClient.doStop(WebSocketClient.java:401)
    at org.eclipse.jetty.util.component.AbstractLifeCycle.stop(AbstractLifeCycle.java:89)
    at anywhersoftware.b4j.objects.WebSocketClientWrapper$2.run(WebSocketClientWrapper.java:83)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)
Caused by: org.eclipse.jetty.websocket.api.UpgradeException: 0 null
    at org.eclipse.jetty.websocket.client.WebSocketUpgradeRequest.onComplete(WebSocketUpgradeRequest.java:513)
    ... 28 more
Caused by: java.nio.channels.AsynchronousCloseException
    ... 17 more
ws Connecting
ws error: 0 null
connected

and

B4X:
java.nio.channels.ClosedChannelException
    at org.eclipse.jetty.io.WriteFlusher.onClose(WriteFlusher.java:507)
    at org.eclipse.jetty.io.ssl.SslConnection$DecryptedEndPoint.onIncompleteFlush(SslConnection.java:527)
    at org.eclipse.jetty.io.AbstractEndPoint$2.onIncompleteFlush(AbstractEndPoint.java:54)
    at org.eclipse.jetty.io.WriteFlusher.write(WriteFlusher.java:331)
    at org.eclipse.jetty.io.AbstractEndPoint.write(AbstractEndPoint.java:372)
    at org.eclipse.jetty.websocket.common.io.FrameFlusher$Flusher.flush(FrameFlusher.java:153)
    at org.eclipse.jetty.websocket.common.io.FrameFlusher$Flusher.process(FrameFlusher.java:217)
    at org.eclipse.jetty.util.IteratingCallback.processing(IteratingCallback.java:241)
    at org.eclipse.jetty.util.IteratingCallback.iterate(IteratingCallback.java:224)
    at org.eclipse.jetty.websocket.common.io.FrameFlusher.enqueue(FrameFlusher.java:382)
    at org.eclipse.jetty.websocket.common.io.AbstractWebSocketConnection.outgoingFrame(AbstractWebSocketConnection.java:614)
    at org.eclipse.jetty.websocket.client.io.WebSocketClientConnection.outgoingFrame(WebSocketClientConnection.java:72)
    at org.eclipse.jetty.websocket.common.io.AbstractWebSocketConnection.onConnectionStateChange(AbstractWebSocketConnection.java:473)
    at org.eclipse.jetty.websocket.common.io.IOState.notifyStateListeners(IOState.java:184)
    at org.eclipse.jetty.websocket.common.io.IOState.onReadFailure(IOState.java:498)
    at org.eclipse.jetty.websocket.common.io.AbstractWebSocketConnection.readParse(AbstractWebSocketConnection.java:666)
    at org.eclipse.jetty.websocket.common.io.AbstractWebSocketConnection.onFillable(AbstractWebSocketConnection.java:511)
    at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:279)
    at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:110)
    at org.eclipse.jetty.io.ssl.SslConnection.onFillable(SslConnection.java:289)
    at org.eclipse.jetty.io.ssl.SslConnection$3.succeeded(SslConnection.java:149)
    at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:110)
    at org.eclipse.jetty.io.ChannelEndPoint$2.run(ChannelEndPoint.java:124)
    at org.eclipse.jetty.util.thread.Invocable.invokePreferred(Invocable.java:128)
    at org.eclipse.jetty.util.thread.Invocable$InvocableExecutor.invoke(Invocable.java:222)
    at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.doProduce(EatWhatYouKill.java:294)
    at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.run(EatWhatYouKill.java:199)
    at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:673)
    at org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:591)
    at java.lang.Thread.run(Thread.java:745)
ws error:
ws error: WebSocket Read EOF
ws Connecting
connected

And then it continues till at some point the app decides to not continue. The errors don´t occur in b4a.
I have the feeling of that there´s a memory limit being hit here, like a bottleneck which causes a buffer underrun throwing the error, but that´s just my idea.
It could of course also be something related to the ssl workaround.
It´s very inconsistant.. sometimes it takes a minute, sometimes 30 till I see any of these errors.

Any suggestions?
 
Last edited:
Upvote 0

kostefar

Active Member
Licensed User
I don't think that it is related to the unauthorized certificate. Please start a new thread and also include the WebSocket url.

Thanks, may I send you the file in a direct message? Some of the things in there may or may not expose some private data, although I doubt it. Better to be safe though.
 
Upvote 0
Top