Hi me again, is there a way to check if the nonBlo...
# http4k
a
Hi me again, is there a way to check if the nonBlocking connection is connected / opened or not? I have the issue with the following:
Copy code
val connection = WebsocketClient.nonBlocking(
   Uri.of("<ws://localhost:8080>")
)
        
connection.send(WsMessage("{}"))
The connection is not opened when sending and result into:
Copy code
Exception in thread "main" org.java_websocket.exceptions.WebsocketNotConnectedException
	at org.java_websocket.WebSocketImpl.send(WebSocketImpl.java:608)
	at org.java_websocket.WebSocketImpl.send(WebSocketImpl.java:585)
	at org.java_websocket.client.WebSocketClient.send(WebSocketClient.java:337)
	at org.http4k.client.AdaptingWebSocket.send(WebsocketClient.kt:58)
	at TestKt.main(Test.kt:50)
It is "works" when I add a Thread.sleep(20):
Copy code
val connection = WebsocketClient.nonBlocking(
   Uri.of("<ws://localhost:8080>")
)
Thread.sleep(20)   
connection.send(WsMessage("{}"))
But this isn't the way to go