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 #68

Closed
Alex--Kang opened this issue Dec 4, 2014 · 7 comments
Closed

WebsocketNotConnectedException #68

Alex--Kang opened this issue Dec 4, 2014 · 7 comments

Comments

@Alex--Kang
Copy link

I have a weird situation here (on android device) that I don't know how to go around with it. Please help.

I can connect to the socket without any problem.
The issue i'm facing now is, after socket is connected and after I call
socket.emit("123", message, new Ack() {
@OverRide
public void call(Object... args) {
DoSomething();
}
});

It takes server a while to ack back ( around 50 seconds or so ). The moment I got the ack, the socket get disconnected, and got the following error message. Is there anyway that i could catch this exception gracefully? Thank you very much

12-04 21:39:20.041 19978-20052/AndroidRuntime﹕ FATAL EXCEPTION: EventThread
org.java_websocket.exceptions.WebsocketNotConnectedException
at org.java_websocket.WebSocketImpl.send(WebSocketImpl.java:566)
at org.java_websocket.WebSocketImpl.send(WebSocketImpl.java:543)
at org.java_websocket.client.WebSocketClient.send(WebSocketClient.java:171)
at com.github.nkzawa.engineio.client.transports.WebSocket$2.call(WebSocket.java:114)
at com.github.nkzawa.engineio.parser.Parser.encodePacket(Parser.java:63)
at com.github.nkzawa.engineio.parser.Parser.encodePacket(Parser.java:42)
at com.github.nkzawa.engineio.client.transports.WebSocket.write(WebSocket.java:110)
at com.github.nkzawa.engineio.client.Transport$3.run(Transport.java:98)
at com.github.nkzawa.thread.EventThread.exec(EventThread.java:50)
at com.github.nkzawa.engineio.client.Transport.send(Transport.java:94)
at com.github.nkzawa.engineio.client.Socket$7$1$1.run(Socket.java:344)
at com.github.nkzawa.engineio.client.transports.Polling$1$1.run(Polling.java:49)
at com.github.nkzawa.engineio.client.transports.Polling$1$2.call(Polling.java:64)
at com.github.nkzawa.emitter.Emitter$OnceListener.call(Emitter.java:164)
at com.github.nkzawa.emitter.Emitter.emit(Emitter.java:117)
at com.github.nkzawa.engineio.client.transports.Polling._onData(Polling.java:137)
at com.github.nkzawa.engineio.client.transports.Polling.onData(Polling.java:104)
at com.github.nkzawa.engineio.client.transports.PollingXHR$5$1.run(PollingXHR.java:113)
at com.github.nkzawa.thread.EventThread$2.run(EventThread.java:75)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573)
at java.lang.Thread.run(Thread.java:841)

@nkzawa
Copy link
Contributor

nkzawa commented Dec 6, 2014

Umm, I don't know why this happens .. And it looks like there is no way to catch the error so far.
At least, I think I can fix to be able to catch the error, but I have to reproduce the issue first.

@Alex--Kang
Copy link
Author

It seems like it only happens to my android devices in debug mode.
FYI, we host our node.js on Heroku

Thanks.

@supreddy
Copy link

This happens for me also. I don't have any Ack's in code, but still I get it sometimes. Don't know why.. Is there some server timeout, which is causing this disconnection all of a sudden?

@dpkirchner
Copy link

An easy way to repro this: open a socket and send a socket request once a second or so. Then pause the app in the debugger for a few minutes. When you unpause you'll hit this exception (assuming the server dropped you, which it should have (hopefully).

@nkzawa
Copy link
Contributor

nkzawa commented May 11, 2015

@dpkirchner The websocket transport was replaced by OkHttp Websocket on v0.5.0 recently, thus this issue should not happen anymore. Can you try the latest version?

@dpkirchner
Copy link

I just tried 0.5.0 and was unable to duplicate the exception. I forgot to check if there was a newer version before making my comment.

@nkzawa
Copy link
Contributor

nkzawa commented May 11, 2015

@dpkirchner it's ok, thanks for your report 😄 I think we can close the issue now.

@nkzawa nkzawa closed this as completed May 11, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants