StompProtocolAndroid icon indicating copy to clipboard operation
StompProtocolAndroid copied to clipboard

Stomp client does not subscribe to topics on re-connect.

Open stairs opened this issue 8 years ago • 8 comments

Emitters are not cleaned when sockets are disconnected. Therefore subscribe message would not be sent after re-connect even if we add a new emmiter.

Set<FlowableEmitter<? super StompMessage>> emittersSet = mEmitters.get(destinationPath);
if (emittersSet == null) {
    emittersSet = new HashSet<>();
    mEmitters.put(destinationPath, emittersSet);
    subscribePath(destinationPath, headerList).subscribe();
}
emittersSet.add(emitter);

The problem is that even if I unsubscribe on sockets disconnected it would not help as mentioned here.

stairs avatar Nov 21 '17 22:11 stairs

I'm running into this issue as well, @NaikSoftware.

I've spent some time looking into this, but it looks like it's a dead end for me.

sampaulomon avatar Nov 22 '17 07:11 sampaulomon

Can you try it with the downstream and let me know if you have the same problem? It does the Rx stuff differently, and it's useful for isolating bugs. Let me know your results.

forresthopkinsa avatar Nov 22 '17 15:11 forresthopkinsa

Is there any update on this @NaikSoftware I am facing the same issue. It looks like some problem with disconnect call.

tarunattri avatar Nov 23 '17 05:11 tarunattri

Thanks, @forresthopkinsa! The approach with subject seems much more reasonable. However, in your fork there is still a problem with topics. The list of topics is never cleaned and thus it's impossible to resubscribe on reconnect. I'll create an issue to discuss.

stairs avatar Nov 23 '17 13:11 stairs

Thanks! I'll discuss it with you there.

forresthopkinsa avatar Nov 27 '17 04:11 forresthopkinsa

Hello, I am facing similar kind of problem with the latest version of this library (Root cause may be same). Use case:

  1. When connection is lost, we get ERROR state in lifecycleEvent.
  2. But again when connection is restored, don't get a callback in any of the lifecycleEvent states. (Looking at the states , seems expected)
  3. But already subscribed events doesn't seem to be restored as nothing is received from server.

For interim solution, i have created a runnable which checks Stompclient state. If it is disconnected i make StompClient instance null and recreate a new one. Then again topic events are received. Its not a proper solution, but unless reconnection/topic sunbcribe is taken care from the lib, what are other options ?

souravbasu14 avatar Dec 02 '17 17:12 souravbasu14

Any progress on this?

liluxdev avatar Feb 07 '18 15:02 liluxdev

@creativeprogramming OP and I made another thread about this, which I mentioned a few comments above. It looks like the problem is solved there.

forresthopkinsa avatar Feb 07 '18 21:02 forresthopkinsa