miguelgrinberg / turbo-flask

Integration of Hotwire's Turbo library with Flask.
MIT License
301 stars 35 forks source link

Allow wss connections #8

Closed emieli closed 3 years ago

emieli commented 3 years ago

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.