stomp-js / rx-stomp

STOMP adaptor for RxJS
Apache License 2.0
111 stars 21 forks source link

Error when setting: RxStompConfig.webSocketFactory either SockJs or WebSocket #463

Closed shipra0278 closed 1 year ago

shipra0278 commented 2 years ago

Tried connecting to Websocket 1: Setting up the broker URL: Works great! 2: But when setting the myRxStompConfig.webSocketFactory either SockJs or WebSocket. I get Error. (WebSocket connection to 'ws://amq.........net:30007/ws' failed:)

myRxStompConfig.webSocketFactory = function () { return new WebSocket("ws://amq.net:30007/ws"); //return new SockJS(//'http://localhost:7777/'); };

ERROR: Thu Aug 18 2022 08:26:06 GMT-0500 (Central Daylight Time) 'Opening Web Socket...' rx-stomp-service-factory.ts:15 WebSocket connection to 'ws://amq.........net:30007/ws' failed: config_rx_stomp_config__WEBPACK_IMPORTED_MODULE1.myRxStompConfig.webSocketFactory @ rx-stomp-service-factory.ts:15 _createWebSocket @ client.js:278 (anonymous) @ client.js:211 fulfilled @ client.js:4 invoke @ zone.js:372

rx-stomp.config.ts:29 Thu Aug 18 2022 08:26:06 GMT-0500 (Central Daylight Time) 'Connection closed to undefined'

rx-stomp.config.ts:29 Thu Aug 18 2022 08:26:06 GMT-0500 (Central Daylight Time) 'STOMP: scheduling reconnection in 8000ms'

kum-deepak commented 2 years ago

I do not have an idea why it fails. Please refer to the code block at https://github.com/stomp-js/stompjs/blob/develop/src/client.ts#L516, it has the code that instantiates a new Websocket.

kum-deepak commented 1 year ago

I guess you have figured it out by now. If not please reopen the ticket.