1
1
mirror of https://github.com/srid/ema.git synced 2024-11-29 09:25:14 +03:00

Use secure websocket on HTTPS (#46)

This commit is contained in:
Sridhar Ratnakumar 2021-07-10 09:13:13 -04:00
parent 63162f126b
commit 52f47d4b19
2 changed files with 3 additions and 1 deletions

View File

@ -8,6 +8,7 @@
- Handle invalid routes gracefully without breaking websocket
- Re-add `<script>` tags on hot reload
- Scroll to top on route switches
- Use secure websockets when on HTTPS
- `Asset` type
- Introduce the `Asset` type to distinguishing between static files and generated files. The later can be one of `Html` or `Other`, allowing the live server to handle them sensibly.
- `Ema` typeclass:

View File

@ -245,7 +245,8 @@ wsClientShim =
window.connecting();
// The route current DOM is displaying
var routeVisible = document.location.pathname;
var ws = new WebSocket("ws://" + window.location.host);
var wsProto = (window.location.protocol === "https:") && "wss://" || "ws://";
var ws = new WebSocket(wsProto + window.location.host);
// Call this, then the server will send update *once*. Call again for
// continous monitoring.