forresthopkinsa / StompProtocolAndroid

Websockets on Android
MIT License
11 stars 4 forks source link

the onComplete() call back does not get trigred after subscribe : #12

Open mohdFathi opened 4 years ago

mohdFathi commented 4 years ago

the onComplete() call back does not get trigred after subscribe method :

mStompClient.topic("/topic/hello").subscribe(new Subscriber<StompMessage>() {

            @Override
            public void onSubscribe(Subscription s) {
                Log.d("listenStomp", "onSubscribe");
            }

            @Override
            public void onNext(StompMessage stompMessage) {
                Log.d("listenStomp", "onNext");
                Log.d(TAG, "Received " + stompMessage.getPayload());
            }

            @Override
            public void onError(Throwable t) {
                Log.d("listenStomp", "onError", t);
            }

            @Override
            public void onComplete() {//this is not trigreed after succesful subscribe
                Log.d("listenStomp", "onComplete");
            }
        });
forresthopkinsa commented 4 years ago

onComplete signals the end of the stream, not the success of the subscription.

mohdFathi commented 4 years ago

oook , what if I want to be notified upon successful subscription. I have tried @SubscribeMapping and listening for SessionSubscribeEvent on the back-end but both do not get triggered after subscription...any ideas?

forresthopkinsa commented 4 years ago

You shouldn't need to listen for a successful subscription. You should be ready to respond to events as soon as you subscribe.