ws:// is only allowed if the webpage is served over HTTP. If serving the webpage over HTTPS then a wss:// URL must be sent to the browser.
To do this we attempt to load the ws:// URL first and if the browser throws a DOMexception then we "catch" it and attempts to setup a wss:// URL instead.
ws:// is only allowed if the webpage is served over HTTP. If serving the webpage over HTTPS then a wss:// URL must be sent to the browser. To do this we attempt to load the ws:// URL first and if the browser throws a DOMexception then we "catch" it and attempts to setup a wss:// URL instead.