StompProtocolAndroid icon indicating copy to clipboard operation
StompProtocolAndroid copied to clipboard

Subscribe to a topic that received data too soon, not called its callback method

Open cedb777 opened this issue 5 years ago • 0 comments

Hello,

I have a connection to a websocket.

// Connect to the socket server stompClient = Stomp.over(Stomp.ConnectionProvider.OKHTTP, urlSocket, httpHeader); stompClient.withClientHeartbeat(10000); stompClient.withServerHeartbeat(10000); stompClient.connect();

After that, i subscribe to topics and all is working, example :

stompClient.topic(TOPIC_REPLIES).subscribe(topicMessage -> { String result = topicMessage.getPayload(); socketDataManager.parseResultJson(result); });

But, for one topic, I have to receive data when I subscribe to it. But the callback of the subscribe method is never called ("RESULT FOR THIS TOPIC")

stompClient.topic("/exchange/not/working/topic").subscribe(topicMessage -> { Log.i(TAG, "RESULT FOR THIS TOPIC"); });

I think that I receive the data too soon and so my client is not able to receive the data at the moment it receives it (If the topic is called later, it works fine). Anyone has had the same issue? Is it a solution to receive the data directly when I subscribe ?

Thank you for your help.

cedb777 avatar May 04 '20 10:05 cedb777