TakahikoKawasaki / nv-websocket-client

High-quality WebSocket client implementation in Java.
Apache License 2.0
2.03k stars 292 forks source link

When I send the text message, the service will be close #129

Open Joy-Whale opened 7 years ago

Joy-Whale commented 7 years ago

I send text when service connected, like this @Override public void onConnected(WebSocket websocket, Map<String, List<String>> headers) throws Exception { Logs.d("onConnected"); websocket.sendText("Hello World"); } there is the lifecycle log: onStateChanged CONNECTING onSendingHandshake onStateChanged OPEN onThreadCreated onThreadCreated onThreadStarted onConnected // I send text message at this lifecycle onThreadStarted onFrame onTextFrame onSendingFrame onFrameSent onThreadStopping onSendingFrame onStateChanged CLOSING onFrameSent onStateChanged CLOSED onDisconnected closedByServer ? false onThreadStopping

TakahikoKawasaki commented 7 years ago

I recommend that you NOT call sendXxx methods in onConnected. In general, programmers should avoid calling time-consuming methods from within listener methods.