Skip to content
This repository has been archived by the owner on Jan 6, 2023. It is now read-only.

Question about server errors #189

Open
kum-deepak opened this issue Mar 27, 2020 · 1 comment
Open

Question about server errors #189

kum-deepak opened this issue Mar 27, 2020 · 1 comment

Comments

@kum-deepak
Copy link
Member

By @cainaj, copied from #121 (comment)

Hi, I have a question about error handling with this library. I have something like:

startConnetionProcess() {
    this.connecting = true;
    this.pending = true;
    this.authService.getIdToken()
    .pipe(takeUntil(componentDestroyed(this)))
    .subscribe(token => {
      this.token = token;

      const stompConfig = {
        brokerURL: environment.webSocketUrl + '/api/listen',
        connectHeaders: {
          'token': this.token,
          topic: this.topic,
          env: this.env
        },
        debug(str) {
          console.log('STOMP: ' + str);
        }
      };
      this.connect(stompConfig);
    });
  }

where connect() calls a method that executes configure() and activate().

My problem comes when there is an error on the server side. If this connection is not established, I can see it if I have the debug option on my stompConfig config; however, inside of debug, i cannot call any functions apparently. I am using Angular 8. How can I handle an error? I haven't seen any references to error handling.

@kum-deepak
Copy link
Member Author

Please see https://stomp-js.github.io/api-docs/latest/classes/RxStomp.html#stompErrors$

A compliant STOMP Broker will send ERROR frame in case of an error and close the connection. However some brokers do not adhere to it. See if it helps.

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

No branches or pull requests

1 participant