diff --git a/.env b/.env
index 8435f4f..71fb4a3 100644
--- a/.env
+++ b/.env
@@ -1,2 +1,6 @@
PORT=3001
-ENVIRONMENT=local
\ No newline at end of file
+ENVIRONMENT=dev
+FRONTEND_URL=https://skyjo.voltvector.org
+
+#ENVIRONMENT=local
+#FRONTEND_URL=http://localhost:5173
\ No newline at end of file
diff --git a/.gitignore b/.gitignore
index ec64ed3..2938981 100644
--- a/.gitignore
+++ b/.gitignore
@@ -2,4 +2,6 @@ node_modules
dist
-src/logs/
\ No newline at end of file
+src/logs/
+
+.env.local
\ No newline at end of file
diff --git a/public/index.html b/public/index.html
deleted file mode 100644
index 0b52cec..0000000
--- a/public/index.html
+++ /dev/null
@@ -1,10 +0,0 @@
-
-
- SkyJo Server list
-
-
-
-
SkyJo Server list
-
-
-
diff --git a/src/game/events.ts b/src/game/events.ts
index da047a5..464c972 100644
--- a/src/game/events.ts
+++ b/src/game/events.ts
@@ -19,6 +19,9 @@ export const handleNewGame = (
const { sessionId } = gameDetails;
const players = io.sockets.adapter.rooms.get(sessionId);
+ // get players based on socket
+ const playersInSession = io.sockets.adapter.sids.get(socket.id);
+ console.log("Players in session:", playersInSession?.size);
if (players && players.size > 1) {
const game = new Game(socket, sessionId, players);
diff --git a/src/server.ts b/src/server.ts
index 9132308..48ee502 100644
--- a/src/server.ts
+++ b/src/server.ts
@@ -13,11 +13,15 @@ import corsOptions from "./config/corsOptions";
import cookieParser from "cookie-parser";
import rootRouter from "./routes/root";
import { handleJoinSession, handleNewGame } from "./game/events";
+import dotenv from "dotenv";
+dotenv.config();
+
+const FRONTEND_URL = process.env.FRONTEND_URL ?? "";
const httpServer = new Server(app);
export const io = new SocketIOServer(httpServer, {
cors: {
- origin: "https://skyjo.voltvector.org",
+ origin: FRONTEND_URL,
methods: ["GET", "POST"],
},
});
@@ -36,6 +40,7 @@ io.on("connection", (socket: Socket) => {
socket.on("disconnect", () => {
console.log("A user disconnected:", socket.id);
// TODO: remove players from session and delete game object
+ io;
});
});