forresthopkinsa / StompProtocolAndroid

Websockets on Android
MIT License
11 stars 4 forks source link

Connection opened but not connected #14

Open SohailCheema-145 opened 3 years ago

SohailCheema-145 commented 3 years ago

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());
    });

`

UPocek commented 1 year ago

Still getting this error in 2023. Any solutions, please help asap?

forresthopkinsa commented 1 year ago

I'm sorry but this library is no longer maintained. I recommend looking at Tinder/Scarlet for Websocket applications, though I can't speak to their STOMP capabilities.