onError(ConnectException: Connection refused: no further information)
java.net.ConnectException: Connection refused: no further information
at sun.nio.ch.SocketChannelImpl.checkConnect(Native Method)
at sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:717)
at org.eclipse.jetty.io.SelectorManager.finishConnect(SelectorManager.java:337)
at org.eclipse.jetty.io.ManagedSelector.processConnect(ManagedSelector.java:341)
at org.eclipse.jetty.io.ManagedSelector.access$900(ManagedSelector.java:56)
at org.eclipse.jetty.io.ManagedSelector$SelectorProducer.processSelected(ManagedSelector.java:278)
at org.eclipse.jetty.io.ManagedSelector$SelectorProducer.produce(ManagedSelector.java:170)
at org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.produceAndRun(ExecuteProduceConsume.java:162)
at org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.execute(ExecuteProduceConsume.java:101)
at org.eclipse.jetty.io.ManagedSelector.run(ManagedSelector.java:136)
at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:654)
at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:572)
at java.lang.Thread.run(Thread.java:748)
You not need to catch this. The library is catching this for you and just print that out for debug info.
Means your sketch will proceed even if you got this message on console … just without an established connection … effectively same as ignored …
The reason i am trying to catch it for is that i need the sketch to continue executing if the server is currently unavailable and when this message is shown it stops. Here’s a version that should continue trying to connect after a “connection refused” if i understand correcly, but it stops after the message.
Yes! I’ve checked the sources of WebsocketClient and also not understand why this approach for error handling is implemented as it not gives you any useful possibilities to get it managed…
And It is even worst …
As soon the exception occures (even in setup) the animation thread stops working … but keeps the sketch window open, so also no chance to be able to check in the draw loop (ie. if you be able to reconnect) …
So I guess I have no choice but to recommend you to take the code from the github repo and build your own variant of the WebsocketClient module that allows you a better error handling.
They are also looking for people which do further maintenance of the project. So this is your chance to make the world a little bit better.
Oh, that’s daunting. My experience with websockets and servers in general only includes one tiny project, so i don’t think i’m up for the task. I tried to look at the sources from the github of the library but didn’t understand a thing xD. I guess i’ll try using processing.net with a regular server. Thanks for the help!