aboutsummaryrefslogtreecommitdiff
path: root/client
diff options
context:
space:
mode:
authorJasper Van der Jeugt2020-08-16 12:29:31 +0200
committerJasper Van der Jeugt2020-08-16 12:29:31 +0200
commit5a3fc14c1a92b28423d1b64b64e12d0502a90219 (patch)
treee013cf42b8c2b04d1ebb04914335df1ab2eec048 /client
parent9f2d12f0b098a365d7b0d4cc00b03fd2e5284740 (diff)
Move client to server
Diffstat (limited to 'client')
-rw-r--r--client/index.html51
1 files changed, 0 insertions, 51 deletions
diff --git a/client/index.html b/client/index.html
deleted file mode 100644
index a03d777..0000000
--- a/client/index.html
+++ /dev/null
@@ -1,51 +0,0 @@
-<!DOCTYPE HTML>
-<html>
- <head>
- <meta charset="UTF-8">
- <title>Client</title>
- <link rel="stylesheet" type="text/css" href="$UPLCG_BASE/assets/style.css">
- <meta name="viewport" content="width=device-width">
- </head>
- <body>
- <div id="main"></div>
- <script type="text/JavaScript" src="$UPLCG_BASE/assets/client.js"></script>
- <script>
- var app = Elm.Client.init({node: document.querySelector("main")});
-
- function connect() {
- var protocol = "ws:";
- if(document.location.protocol == "https:") {
- protocol = "wss:"
- }
- var path = document.location.pathname;
- if(path.startsWith("$UPLCG_BASE")) {
- path = path.substr("$UPLCG_BASE".length);
- }
- var roomId = path.split("/")[2];
- var url = protocol + "//" + document.location.host +
- "$UPLCG_BASE/rooms/" + roomId + "/events";
-
- var socket = new WebSocket(url);
- var socketSend = function(message) {
- socket.send(message);
- };
- app.ports.webSocketOut.subscribe(socketSend);
- socket.onmessage = function(event) {
- app.ports.webSocketIn.send(event.data);
- };
- socket.onclose = function(event) {
- app.ports.webSocketOut.unsubscribe(socketSend);
- setTimeout(function() {
- connect();
- }, 1000);
- };
- socket.onerror = function(event) {
- socket.close();
- };
- }
-
- connect();
- </script>
- <footer>Untitled PL Card Game version $UPLCG_VERSION</footer>
- </body>
-</html>