Fix server URL for WebSockets.

This commit is contained in:
James Murdza 2024-07-31 18:35:28 -07:00
parent e8a3944b9e
commit 2eb2c4c39b

View File

@ -31,7 +31,7 @@ export const TerminalProvider: React.FC<{ children: React.ReactNode }> = ({ chil
useEffect(() => {
if (userId && sandboxId) {
console.log("Initializing socket connection...");
const newSocket = io(`${window.location.protocol}//${window.location.hostname}:${process.env.NEXT_PUBLIC_SERVER_PORT}?userId=${userId}&sandboxId=${sandboxId}`);
const newSocket = io(`${process.env.NEXT_PUBLIC_SERVER_URL}?userId=${userId}&sandboxId=${sandboxId}`);
console.log("Socket instance:", newSocket);
setSocket(newSocket);