stomp-js/stompjs

Connection errors and iframe not found

Closed this issue · 5 comments

Screenshot 2024-11-18 at 11 16 28

  1. The first error says that the WebSocket connection failed, but just below it says that it was connected. Is this correct?
  2. Soon after I get a 404 error because the iframe was not found. Why would I try to load an iframe from my API?

Are you using SockJS?

Please share your configuration for the Stomp instance.

@kum-deepak Here are the libs I'm using and my connection

My dependencies:
"@stomp/stompjs": "^7.0.0"
"sockjs-client": "^1.6.1"

My dev dependencies
"@types/sockjs-client": "^1.5.4"
"@types/stompjs": "^2.3.9"

Screenshot 2024-11-18 at 13 10 36

SockJS is not WebSocket (please see https://stomp-js.github.io/guide/stompjs/rx-stomp/using-stomp-with-sockjs.html).

SockJS is an emulation of WebSocket that tries multiple ways to establish a connection, one of which is to use a hidden IFrame.

Another remark: you do not need "@types/stompjs": "^2.3.9". It is a for a different library. The "@stomp/stompjs" includes the type definitions.

Thank you very much @kum-deepak , with your comments I was able to solve the problem.