stomp-js / ng2-stompjs

Angular 6 and 7 - Stomp service over Websockets
https://stomp-js.github.io/
Apache License 2.0
182 stars 32 forks source link

No message provided to error "WebSocket connection to url failed: " #246

Open Donkijote opened 3 years ago

Donkijote commented 3 years ago

Hi, recently the company I'm working for made some changes in the cloud architecture and change the Kong api gateway version they where using and that cause a websocket error, and the problem is that the error message is empty and I can not identify what is causing the websocket to fail.

This is what is being log to the console:

debugging... Opening Web Socket... WebSocket connection to 'wss://apiurl/socket' failed: client.js:274 debugging... Connection closed to wss://apiurl/socket debugging... STOMP: scheduling reconnection in 5000ms debugging... Connection not established in 10000ms, closing socket

this is my config:

  this.rxStompService.configure({
    brokerURL: environment.websocket,
    debug: (msg) => {
      console.log('debugging...' + msg);
    },
  });

  this.rxStompService.activate();

  this.wsSubscription = this.rxStompService
    .watch('/topic/group/'+this.groupId)
    .subscribe(
      (data) => {
        const body: Websocket = JSON.parse(data.body);
        this.alertService.messageIzi(
          'New ${body.countCases} cases'
        );
      },
      (error) => {
        console.error(error);
      }
    );

Thanks very much for your help