diff --git a/deploy/nginx-ws-proxy.conf b/deploy/nginx-ws-proxy.conf new file mode 100644 index 0000000..7b55d7c --- /dev/null +++ b/deploy/nginx-ws-proxy.conf @@ -0,0 +1,27 @@ +http { + map $http_upgrade $connection_upgrade { + default upgrade; + '' close; + } + + upstream websocket { + server staging.c3lf.de:443; + } + + server { + listen 8082; + access_log /home/jedi/Projects/c3lf-system-3/deploy/foo.log; + location / { + proxy_pass https://websocket; + proxy_http_version 1.1; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection $connection_upgrade; + proxy_set_header Origin "https://staging.c3lf.de/"; + proxy_set_header Host $host; + } + } +} + +events {} + +pid /home/jedi/Projects/c3lf-system-3/deploy/nginx.pid; \ No newline at end of file diff --git a/web/public/js/worker.js b/web/public/js/worker.js deleted file mode 100644 index 19f4203..0000000 --- a/web/public/js/worker.js +++ /dev/null @@ -1,50 +0,0 @@ -let state = 0; -let ports = []; -let notify_socket; - -function tryConnect(){ - if(self.WebSocket === undefined){ - console.log("no websocket support"); - return; - } - if (!notify_socket || notify_socket.readyState !== WebSocket.OPEN) { - const scheme = location.protocol === "https:" ? "wss" : "ws"; - notify_socket = new WebSocket(scheme + '://' + location.host + '/ws/2/notify/'); - notify_socket.onopen = (e) => { - console.log("open", JSON.stringify(e)); - }; - notify_socket.onclose = (e) => { - console.log("close", JSON.stringify(e)); - setTimeout(() => { - tryConnect(); - }, 1000); - }; - notify_socket.onerror = (e) => { - console.log("error", JSON.stringify(e)); - setTimeout(() => { - tryConnect(); - }, 1000); - }; - notify_socket.onmessage = (e) => { - let data = JSON.parse(e.data); - console.log("message", data); - //this.loadEventItems() - //this.loadTickets() - } - } -} - -onconnect = function (e) { - const port = e.ports[0]; - ports.push(port); - port.onmessage = function (e) { - state = state + 1; - for (let i = 0; i < ports.length; i++) { - ports[i].postMessage({d: e.data, s: state, n: ports.length}); - } - } - port.start(); - console.log("worker connected", JSON.stringify(e)); - tryConnect(); -} - diff --git a/web/src/views/admin/Debug.vue b/web/src/views/admin/Debug.vue index 1acde81..683525c 100644 --- a/web/src/views/admin/Debug.vue +++ b/web/src/views/admin/Debug.vue @@ -1,39 +1,50 @@