davinkevin / AngularStompDK

Angular service to communicate to Stomp-Websocket
http://davinkevin.github.io/AngularStompDK/
Apache License 2.0
36 stars 12 forks source link

providing relative URL without protocol and hostname doesnt work #3

Closed mihn closed 9 years ago

mihn commented 9 years ago
 .config(function (ngstompProvider) {
        ngstompProvider
            .url('ws://localhost:9000/websocket');
    })

does work, but when used as in readme:

 .config(function (ngstompProvider) {
        ngstompProvider
            .url('/websocket');
    })

it doesnt. At this moment i have to use following hack:

 .config(function (ngstompProvider) {
        ngstompProvider
            .url('ws://' + window.location.host + '/websocket');
    })
davinkevin commented 9 years ago

Thanks for this information, I will treat this issue as soon as possible.

mihn commented 9 years ago

Another issue might be detecting to use SSL (wss protocol), when page is using TLS.

davinkevin commented 9 years ago

I will treat both with this issue. The goal is to use following syntax :

The first will use the same protocol and host, the second only the protocol and the third, the whole url. If you have idea of implementation, you can do a PR if you want to contribute ;)

davinkevin commented 9 years ago

For information, do you work with SockJS ? In my other project using AngularStompDK, I use the config with just the path and everything works (https://github.com/davinkevin/Podcast-Server/blob/master/src/main/resources/static/app/js/modules/config/ngstomp.config.es6.js)

I suspect SockJS to do the path resolution on its own in my case.

mihn commented 9 years ago

No. Plain stomp. 1 lip 2015 12:12 "Davin Kevin" notifications@github.com napisał(a):

For information, do you work with SockJS ? In my other project using AngularStompDK, I use the config with just the path and everything works ( https://github.com/davinkevin/Podcast-Server/blob/master/src/main/resources/static/app/js/modules/config/ngstomp.config.es6.js )

I suspect SockJS to do the path resolution on its own.

— Reply to this email directly or view it on GitHub https://github.com/davinkevin/AngularStompDK/issues/3#issuecomment-117580571 .

mihn commented 9 years ago

Just tested and it works fine with SockJS :+1:

davinkevin commented 9 years ago

I've search a lot of "simple" solution to provide what I explain the 1 July, but it seems I need to do all the parsing in the provider part...

I don't think this add a lot of value, SockJS enable it by default, Stomp doesn't, and using an external dependency (like URL.js or others) isn't in the spirit of the AngularStompDK (simple and light).

The hack you use is a straightforward solution and do the job right now... So I tag it WONTFIX and close the ticket.