Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WebsocketNotConnectedException #217

Open
Jeff11 opened this issue Aug 15, 2019 · 1 comment
Open

WebsocketNotConnectedException #217

Jeff11 opened this issue Aug 15, 2019 · 1 comment
Labels

Comments

@Jeff11
Copy link

Jeff11 commented Aug 15, 2019

With Pusher 2.0.0
SM-G950F, Android 9

Non-fatal Exception: org.java_websocket.exceptions.WebsocketNotConnectedException
  at org.java_websocket.WebSocketImpl.send + 630(WebSocketImpl.java:630)
  at org.java_websocket.WebSocketImpl.send + 607(WebSocketImpl.java:607)
  at org.java_websocket.client.WebSocketClient.send + 344(WebSocketClient.java:344)
  at com.pusher.client.connection.websocket.WebSocketConnection$3.run + 132(WebSocketConnection.java:132)
  at com.pusher.client.util.Factory$1.run + 109(Factory.java:109)
  at java.util.concurrent.ThreadPoolExecutor.runWorker + 1167(ThreadPoolExecutor.java:1167)
  at java.util.concurrent.ThreadPoolExecutor$Worker.run + 641(ThreadPoolExecutor.java:641)
  at java.lang.Thread.run + 764(Thread.java:764)
@elverkilde
Copy link
Contributor

Hi @Jeff11 ,

My best guess is that this happens here:
https://github.com/pusher/pusher-websocket-java/blob/master/src/main/java/com/pusher/client/connection/websocket/WebSocketConnection.java#L131-L132

i.e. the connection is dropped, but the internal state here is still CONNECTED. Basically it's a race, and the way the library is currently designed, I don't see how we can prevent that from happening.

My best advice would be to catch that exception, which is would this library should ideally do (i.e. not send the message).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants