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

Crash on unsubscribe from topic after ERROR is received #8

Open
stairs opened this issue Dec 2, 2017 · 4 comments
Open

Crash on unsubscribe from topic after ERROR is received #8

stairs opened this issue Dec 2, 2017 · 4 comments

Comments

@stairs
Copy link

stairs commented Dec 2, 2017

When socket error is reported and we try to unsubscribe from the topic, IllegalStateException will be thrown as shown below:

    @NonNull
    @Override
    public Completable send(String stompMessage) {
        return Completable.fromCallable(() -> {
            if (getSocket() == null) {
                throw new IllegalStateException("Not connected yet");
            } else {
                Log.d(TAG, "Send STOMP message: " + stompMessage);
                rawSend(stompMessage);
                return null;
            }
        });
    }

Could we maybe just check when unsubscribing if actual event should be sent based on sockets state?

@forresthopkinsa
Copy link
Owner

I'll look into this more later today. Thanks for the report :)

@stairs
Copy link
Author

stairs commented Dec 6, 2017

Would you mind if I just create a quick fix to check if a connection is still live before trying to send unsubscribe event? Other possible quick solution would be to just log an attempt to send a message when the connection is closed instead of crashing the app.

@forresthopkinsa
Copy link
Owner

Hi! Sorry, I just got back from a vacation in Mexico :) sorry to keep you waiting!

I'll resume work on this today or tomorrow, but yeah, if you make a working fix then I'll totally look into that.

@stairs
Copy link
Author

stairs commented Dec 11, 2017

Glad to hear that you are back! Regarding the issue, I don't see a decent fix without exposing provider details. Would you mind if we just don't throw runtime exception on sending unsubscribe event?

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

2 participants