diff --git a/docker/nginx.conf b/docker/nginx.conf index 1e4856e6..163d0660 100644 --- a/docker/nginx.conf +++ b/docker/nginx.conf @@ -20,7 +20,7 @@ http { } # Proxy SSH socket requests - location /ssh-socket.io/ { + location /ssh.io/ { proxy_pass http://127.0.0.1:8081; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; @@ -30,7 +30,7 @@ http { } # Proxy database requests - location /database-socket.io/ { + location /database.io/ { proxy_pass http://127.0.0.1:8082; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; diff --git a/src/App.jsx b/src/App.jsx index 105b2376..db8ecfde 100644 --- a/src/App.jsx +++ b/src/App.jsx @@ -371,6 +371,15 @@ function App() { /> {isLaunchpadOpen && setIsLaunchpadOpen(false)} />} + + {/* User component */} { ? "http://localhost:8081" : "/", { - path: "/ssh-socket.io/", + path: "/ssh.io/", transports: ["websocket", "polling"], } ); diff --git a/src/User.jsx b/src/User.jsx index 1ad65e99..61361864 100644 --- a/src/User.jsx +++ b/src/User.jsx @@ -2,15 +2,15 @@ import { useRef, forwardRef, useImperativeHandle } from "react"; import io from "socket.io-client"; import PropTypes from "prop-types"; -let socket = null; +let socket; -if (socket === null) { +if (!socket) { socket = io( window.location.hostname === "localhost" ? "http://localhost:8082" : "/", { - path: window.location.hostname === "localhost" ? "/" : "/database-socket.io/", + path: "/database.io", transports: ["websocket", "polling"], } );