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

Possible to subscribe, unsubscribe, and resubscribe? v1.2.0 #79

Closed
padmaia opened this issue Nov 11, 2015 · 2 comments
Closed

Possible to subscribe, unsubscribe, and resubscribe? v1.2.0 #79

padmaia opened this issue Nov 11, 2015 · 2 comments
Assignees
Labels
bug
Milestone

Comments

@padmaia
Copy link

@padmaia padmaia commented Nov 11, 2015

When I try to subscribe, unsubscribe, and then resubscribe I am getting the error 'Client already subscribed'. When I try subscribing twice to the same path with same socket I just end up getting the data twice.

Here is a code example:

subscribe(id) {
    clientSocket.subscribe(`/conversations/${id}`, (err, msg) => {
        if (msg) // dispatch action
        if (err) console.error(err);
    });
}

unsubscribe(id) {
    clientSocket.unsubscribe(`/conversations/${id}`);
}

*Both methods live in the same file. The socket client is initiated in another module and required into this one.

When I peek into clientSocket.subscriptions(), it has the path before I unsubscribe and is empty after I unsubscribe. Is this expected behavior?

@hueniverse hueniverse added the bug label Nov 13, 2015
@hueniverse hueniverse self-assigned this Nov 13, 2015
@hueniverse hueniverse added this to the 1.2.1 milestone Nov 13, 2015
@hueniverse

This comment has been minimized.

Copy link
Member

@hueniverse hueniverse commented Nov 13, 2015

Can you confirm 1.2.1 fixes your issue?

@padmaia

This comment has been minimized.

Copy link
Author

@padmaia padmaia commented Nov 13, 2015

Yes, that seems to have resolved the issue. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.