codecombat/treema

Allow for secure websockets

Opened this issue · 0 comments

The current implementation of treema has ws:// built in for websockets, however this fails for all browsers but Chrome when displaying a HTTPS page.
On HTTPS, we want to use wss:// as protocol instead.
We could use something like

if ("https:" == document.location.protocol) {
    /* secure */
} else {
    /* unsecure */
}

as seen in:
http://stackoverflow.com/questions/282444/how-can-i-use-javascript-on-the-client-side-to-detect-if-the-page-was-encrypted
or pass the option in as a parameter (firebase seems to go that path).
/edit: It seems firebase is also parsing the url, just somewhere else