feat: refactor Socket.IO server implementation and update README for queue system

This commit is contained in:
2025-09-19 18:51:28 +02:00
parent e60c801f4e
commit ff81967a59
6 changed files with 307 additions and 179 deletions

View File

@@ -15,11 +15,12 @@ export default function Home() {
useEffect(() => {
let mounted = true;
// dynamic import to avoid bundling issues on server
import("socket.io-client").then(({ io }) => {
if (!mounted) return;
// default to the same origin and connect to the Next.js API route at /api/socket
const serverUrl = process.env.NEXT_PUBLIC_SOCKET_URL || window.location.origin;
const socket = io(serverUrl, { autoConnect: true, path: "/api/socket" });
import("socket.io-client").then(({ io }) => {
if (!mounted) return;
const socket = io({
path: "/api/socket",
autoConnect: true
});
socketRef.current = socket;
socket.on("connect", () => {