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

subscribe not working on topic #10

Open
LovepreetSinghLotey opened this issue Apr 28, 2019 · 8 comments
Open

subscribe not working on topic #10

LovepreetSinghLotey opened this issue Apr 28, 2019 · 8 comments

Comments

@LovepreetSinghLotey
Copy link

StompClient client = Stomp.over(Stomp.ConnectionProvider.OKHTTP, "ws://192.168.1.75:9464/chatServer");
client.connect();

    client.topic("topic.58.rooms")
            .subscribe ( stompMessage -> {
                System.out.println("-----------------------------");
               
            });

message from server is receiving and showing in logcat but is not receiving in the subscribe block

@forresthopkinsa
Copy link
Owner

I'm not completely understanding your issue. You say you can see that you're receiving the message in Logcat -- what are you seeing, exactly? I need a lot more details.

However, I highly recommend that you use Scarlet for any new projects. The StompProtocolAndroid libs are outdated.

@LovepreetSinghLotey
Copy link
Author

scarlet has no documentation for STOMP, and by what i said is, the response from server is coming to the okHttpConnectionProvider's (text receive block), but is not getting emitted to my subscribe block.

@forresthopkinsa
Copy link
Owner

Still not enough detail. Show me logs and code.

@NeerajThapliyal
Copy link

i have written code like this
StompClient client = Stomp.over(Stomp.ConnectionProvider.JWS, "ws://192.168.225.133:9191/ws");

    client.connect();
    client.topic("/topic/greetings").subscribe(message -> {
        Log.i("topic", "Received message: " + message.getPayload());
    },error->Log.e("topic","===>error during subscribe topic"));

    client.send("/app/hello", "world").subscribe(
            () -> Log.d("sendm", "Sent data!"),
            error -> Log.e("sendm", "Encountered error while sending data!", error)
    );

but could getting topic subscribe logs. here is my logs
D/WebSocketsConnectionProvider: onWebsocketHandshakeReceivedAsClient with response: 101 Switching Protocols
D/WebSocketsConnectionProvider: onOpen with handshakeData: 101 Switching Protocols
D/AbstractConnectionProvider: Emit lifecycle event: OPENED
D/AbstractConnectionProvider: Send STOMP message: CONNECT
version:1.1,1.0
heart-beat:0,0

��

D/socket: Stomp connection opened

@forresthopkinsa
Copy link
Owner

Looks like you're successfully connected, are you sure the server is sending anything to that topic?

@NeerajThapliyal
Copy link

@forresthopkinsa server sending data in topic .
i have solved that issue by enable cleartext support in android
https://stackoverflow.com/questions/45940861/android-8-cleartext-http-traffic-not-permitted/50834600#50834600

@violettomsk
Copy link

What happens when I subscribe too fast while websocket is connecting?

@forresthopkinsa
Copy link
Owner

@violettomsk I'd expect it to subscribe to the topic once the connection completes. Is that the behavior you observe?

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

4 participants