import { Client } from "@stomp/stompjs"; const BACKEND_URL = process.env.NEXT_PUBLIC_BACKEND_URL || ""; export function createStompClient(token) { return new Client({ webSocketFactory: () => { const SockJS = require("sockjs-client"); return new SockJS(`${BACKEND_URL}/ws/chat-sockjs`); }, connectHeaders: { Authorization: `Bearer ${token}` }, reconnectDelay: 5000, heartbeatIncoming: 10000, heartbeatOutgoing: 10000, }); }