Dockerize

This commit is contained in:
Zimeng Xiong
2025-11-21 23:43:53 -08:00
parent 5979293e1b
commit e87987a0a3
19 changed files with 701 additions and 7 deletions
+8 -2
View File
@@ -99,8 +99,14 @@ export const Editor: React.FC = () => {
useEffect(() => {
if (!id || !isReady) return;
const socket = io(import.meta.env.VITE_API_URL || 'http://localhost:8000', {
transports: ['websocket'],
// For production/Docker, connect to same origin. For dev, use localhost:8000
const socketUrl = import.meta.env.VITE_API_URL === '/api'
? window.location.origin
: (import.meta.env.VITE_API_URL || 'http://localhost:8000');
const socket = io(socketUrl, {
path: '/socket.io',
transports: ['websocket', 'polling'],
});
socketRef.current = socket;