Skip to content

Connection opened but not connected #14

Open
@SohailCheema-145

Description

@SohailCheema-145

Please have a look at my code below. I can see in the logs that connection is opened but when I try to send message and check connection status it shows Disconnected. I have also tried
client = Stomp.over(Stomp.ConnectionProvider.OKHTTP, "ws://a3ec3382fa18.ngrok.io/websocket");

`
client = Stomp.over(Stomp.ConnectionProvider.OKHTTP, "http://a3ec3382fa18.ngrok.io/websocket");

    client.lifecycle().subscribe(lifecycleEvent -> {
        switch (lifecycleEvent.getType()) {
            case OPENED:
                Log.d(TAG, "Stomp connection opened");

                if (client.isConnected()) {
                    Log.e(TAG, "Connected");
                } else
                    Log.e(TAG, "Disconnected");
                
                break;
            case CLOSED:
                Log.d(TAG, "Stomp connection closed");
                break;
            case ERROR:
                Log.e(TAG, "Stomp connection error", lifecycleEvent.getException());
                break;
        }
    });
    client.setHeartbeat(10000);
    client.connect();

    client.topic("/topic/chat").subscribe(message -> {
        Log.i(TAG, "ReceivedMessage: " + message.getPayload());
    });

`

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions