From c8b5f665749ba61fa9b13e57cc73f0f86bfd9399 Mon Sep 17 00:00:00 2001 From: AzizbekFayziyev Date: Fri, 4 Jul 2025 19:08:52 +0500 Subject: [PATCH] fix: socket --- .env.example | 3 ++- src/utils/socket.ts | 9 +++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) 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;