fix: remove hardcoded reference to localhost

This commit is contained in:
James Murdza 2024-06-16 20:01:00 -04:00
parent 97c8598717
commit ed709210e3

View File

@ -46,7 +46,7 @@ export default function CodeEditor({
// Initialize socket connection if it doesn't exist
if (!socketRef.current) {
socketRef.current = io(
`http://localhost:${process.env.NEXT_PUBLIC_SERVER_PORT}?userId=${userData.id}&sandboxId=${sandboxData.id}`,
`${window.location.protocol}//${window.location.hostname}:${process.env.NEXT_PUBLIC_SERVER_PORT}?userId=${userData.id}&sandboxId=${sandboxData.id}`,
{
timeout: 2000,
}