Skip to content
Permalink
Browse files

add basic websocket support

  • Loading branch information...
cbrake committed Dec 27, 2018
1 parent 66fb95e commit c8d70ab1e5c54ec1bea69f619a86ad3f753e5dc7
Showing with 17 additions and 0 deletions.
  1. +17 −0 frontend/index.html
@@ -18,5 +18,22 @@

<script type="text/javascript">
var app = Elm.Main.init();
var loc = window.location, new_uri;
if (loc.protocol === "https:") {
ws_uri = "wss:";
} else {
ws_uri = "ws:";
}
ws_uri += "//" + loc.host;
ws_uri += "/ws";
var conn = new WebSocket(ws_uri);
conn.onclose = function(evt) {
console.log("WS connection closed");
}
conn.onmessage = function(evt) {
var obj = JSON.parse(evt.data);
app.ports.portIn.send(obj);
}
</script>
</html>

0 comments on commit c8d70ab

Please sign in to comment.
You can’t perform that action at this time.