diff --git a/.env.example b/.env.example index 4b9fccf..f567ffc 100644 --- a/.env.example +++ b/.env.example @@ -1 +1,2 @@ -API_URL="http://localhost:3000" \ No newline at end of file +API_URL="backend url" +NEXT_PUBLIC_URL="backend url" \ No newline at end of file diff --git a/src/utils/socket.ts b/src/utils/socket.ts index 2768937..be3e0a6 100644 --- a/src/utils/socket.ts +++ b/src/utils/socket.ts @@ -1,5 +1,10 @@ -import io from 'socket.io-client'; +import { io } from 'socket.io-client'; -const socket = io(); +const SOCKET_URL = process.env.NEXT_PUBLIC_API_URL as string; + +const socket = io(SOCKET_URL, { + transports: ['websocket'], + withCredentials: true, +}); export default socket;