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

org.java_websocket.exceptions.WebsocketNotConnectedException #91

Open
juanmanuelarze opened this issue Oct 25, 2018 · 0 comments
Open

Comments

@juanmanuelarze
Copy link

Hi, i have this fatal crash

org.java_websocket.exceptions.WebsocketNotConnectedException: null
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.flush(Socket.java:596)
at com.github.nkzawa.engineio.client.Socket.sendPacket(Socket.java:681)
at com.github.nkzawa.engineio.client.Socket.sendPacket(Socket.java:655)
at com.github.nkzawa.engineio.client.Socket.access$1500(Socket.java:29)
at com.github.nkzawa.engineio.client.Socket$17.run(Socket.java:565)
at com.github.nkzawa.thread.EventThread.exec(EventThread.java:50)
at com.github.nkzawa.engineio.client.Socket.ping(Socket.java:562)
at com.github.nkzawa.engineio.client.Socket$16$1.run(Socket.java:550)
at com.github.nkzawa.thread.EventThread$2.run(EventThread.java:75)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607)
at java.lang.Thread.run(Thread.java:761)

I know this happend when the apps try to send an event and the socket is not connected, but i want to know how to deal with the application crash.

This is an example of my function:

try{

            if(mSocket != null && mSocket.connected()){

                pack.setToken(this.token);
                String packString = pack.toStringForPackage();
                mSocket.emit("send", packString);

            }

        }catch (WebsocketNotConnectedException e){
            e.printStackTrace();
        }catch(Exception e){
            e.printStackTrace();
        }
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

1 participant