Various improvements

This commit is contained in:
2024-05-14 17:44:57 +02:00
parent 49d874ad6d
commit b24f87e883
15 changed files with 1885 additions and 91 deletions

17
painter-js/src/socket.js Normal file
View File

@@ -0,0 +1,17 @@
import io from "socket.io-client";
const isDebug = import.meta.env.VITE_IS_DEBUG === "true";
const wsProtocol = window.location.protocol === "https:" ? "wss:" : "ws:";
const wsHost = window.location.host;
let socket;
if (isDebug) {
socket = io("ws://localhost:3000");
} else {
socket = io(`${wsProtocol}//${wsHost}`, {
transports: ["websocket"],
});
}
export default socket;