Skip to content
This repository has been archived by the owner on May 5, 2021. It is now read-only.

Subscription to second channel overrides the first subscriber #43

Closed
kuceram opened this issue Aug 11, 2017 · 5 comments
Closed

Subscription to second channel overrides the first subscriber #43

kuceram opened this issue Aug 11, 2017 · 5 comments
Labels

Comments

@kuceram
Copy link

kuceram commented Aug 11, 2017

This error happens when you send headers object to subscription method like this:

var headers = {'Authorization': `Bearer 123`};
var subscription1 = client.subscribe(destination1, callback1, headers);
var subscription2 = client.subscribe(destination2, callback2, headers);

If you do the second subscription you loose the reference to the first one (callback destination1 is never called). This issue came due to the fact that you break the atomicity rule:
https://github.com/JSteunou/webstomp-client/blob/master/src/client.js#L269

You should not manipulate object that are coming from outside.

@JSteunou
Copy link
Owner

Interesting, I suppose calling subscribe with a clone of headers fix the issue temporary, does it?

@kuceram
Copy link
Author

kuceram commented Aug 14, 2017

Yes it does. But I would suggest to do a clone internally within the subscribe method as method user might not be aware of this. It is also hard to debug this inconvenient.

@JSteunou JSteunou added the bug label Sep 7, 2017
@JSteunou
Copy link
Owner

JSteunou commented Oct 3, 2017

@kuceram is that ok for you?

@kuceram
Copy link
Author

kuceram commented Oct 17, 2017

Hi, sorry for late respond. I will check it out as soon as possible and let you know. :-)

@kuceram
Copy link
Author

kuceram commented Oct 19, 2017

Works fine, now...

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants