How to get inmediate feedback after subscription
Hello,
When I execute this piece of code:
const susbcription = this.client.subscribe(...)
It always returns a valid subscription, even if the final destination does not exist on the server.
It is also true that I automatically receive a Stomp Error but I'd also like to get that "feedback" at subscription time. Is it possible?
I would like to do somethig like:
const subscription = this.client.subscribe(...)
if (subscription) {
...
} else {
...
}
Thanks in advance.
The STOMP protocol does not offer a mechanism to check whether an endpoint exists or whether the client has the required permissions. Please check https://stomp.github.io/stomp-specification-1.2.html
The best I can recommend is to use receipts https://stomp-js.github.io/api-docs/latest/classes/Client.html#watchForReceipt. However, if the subscription fails, you will still get an error frame followed by a disconnect. In addition, the actual behaviour may vary based on the specific broker.