varvet / mobile-websocket-example

Mobile websocket example
385 stars 154 forks source link

send method not working #8

Open relferreira opened 9 years ago

relferreira commented 9 years ago

In the Android example, this method is not sending the message

public void sendMessage(View view) {
        EditText editText = (EditText)findViewById(R.id.message);
        mWebSocketClient.send(editText.getText().toString());
        editText.setText("");
    }

I get the following exception:

org.java_websocket.exceptions.WebsocketNotConnectedException

I have checked, and the onOpen method is called, and the onClose is not called. I also checked that calling the "send" method inside one of the Overrided methods, like onMessage, it works.

Am I doing something wrong? I want to send a message with the click of an item in a listview.

Thanks in advance.

ryderz8 commented 9 years ago

Hey @relferreira , have you got this working ? I am stuck on same exception.

huzhenjie commented 8 years ago

@ryderz8 me too

sashakid commented 8 years ago

Doesn't work