codecombat / treema

jQuery plugin that generates HTML interfaces to edit JSON data defined by json-schema.
http://codecombat.github.io/treema/
MIT License
152 stars 36 forks source link

Allow for secure websockets #24

Open domenukk opened 10 years ago

domenukk commented 10 years ago

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