stomp-js / ng2-stompjs-angular7

n2-stompjs sample for Angular 7
15 stars 11 forks source link

InjectableRxStompConfig brokerURL #18

Closed kosaa closed 5 years ago

kosaa commented 5 years ago

It is posibile to set pass URL without prefix 'ws'?

I copied rxStompConfig: InjectableRxStompConfig from examples and only set brokerURL to 'http://localhost:8080/ws'

in the console I got only one line:

Tue Sep 10 2019 19:20:34 GMT+0200 (Central European Summer Time) "Opening Web Socket..."

and this subscribe method

this.rxStompService.connected$.subscribe(v => {
    console.log('alive!', v);
});

is never connected

What can do wrong?

kum-deepak commented 5 years ago

The URL pattern 'http://localhost:8080/ws' suggests that your broker uses SockJS which is not same as WebSocket protocol. It is supported through SockJS library. Please see https://stomp-js.github.io/guide/stompjs/rx-stomp/ng2-stompjs/2018/09/10/using-stomp-with-sockjs.html

Let me know if it helps.

kosaa commented 5 years ago

oohhh, thank you :) good to know