You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
(Notice that I didn't pass subscribeHeaders first)
I kept some breakpoints to debug in react-stomp/dist/client.js and stompjs/lib/stomp.js to see what ids get assigned to those subscriptions.
This (Above image) is the first call in react-stomp/dist/client.js for the first topic. we can see subscribeHeaders in this.props is nothing but a blank object.
This (Above image) is the first call of subscribe function in stompjs/lib/stomp.js and we get blank object as headers argument.
This (Above image) is the second call in react-stomp/dist/client.js for the second topic (Notice that, this time we get subscribeHeaders out of nowhere)
This (Above image) is the second call of subscribe fn in stompjs/lib/stomp.js for the second topic: (Now, we have headers in parameters so we the second "if" condition will be false hence, giving the same id to te second topic also)
This whole strange problem can be solved by passing "subscribeHeaders={null}" and then each topic starts getting different ids (i.e. "sub-0", "sub-1")
<SockJsClient
url={apiUrl}
subscribeHeaders={null} //only works when passed "null". Doesn't work if passed blank object "{}"
topics={this.props.topics}
onMessage={this.onMessage}
ref={(client) => { this.clientRef = client; }}
debug
/>
The text was updated successfully, but these errors were encountered:
This is the strange behaviour I encountered while subscribing to multiple topics.
These are the topics passed:
(Notice that I didn't pass subscribeHeaders first)
I kept some breakpoints to debug in
react-stomp/dist/client.js
andstompjs/lib/stomp.js
to see what ids get assigned to those subscriptions.This (Above image) is the first call in
react-stomp/dist/client.js
for the first topic. we can see subscribeHeaders in this.props is nothing but a blank object.This (Above image) is the first call of subscribe function in
stompjs/lib/stomp.js
and we get blank object as headers argument.This (Above image) is the second call in
react-stomp/dist/client.js
for the second topic (Notice that, this time we get subscribeHeaders out of nowhere)This (Above image) is the second call of subscribe fn in
stompjs/lib/stomp.js
for the second topic: (Now, we have headers in parameters so we the second "if" condition will be false hence, giving the same id to te second topic also)This whole strange problem can be solved by passing "subscribeHeaders={null}" and then each topic starts getting different ids (i.e. "sub-0", "sub-1")
The text was updated successfully, but these errors were encountered: