mirror of
https://github.com/legop3/MultiRoombaRover.git
synced 2026-09-16 09:31:20 -04:00
guh
This commit is contained in:
+10
-9
@@ -1,12 +1,13 @@
|
||||
import { io } from "socket.io-client";
|
||||
import { io } from 'socket.io-client';
|
||||
|
||||
console.log('socket.io client loaded')
|
||||
const configuredUrl = import.meta.env.VITE_ROVERD_URL?.trim();
|
||||
const serverUrl = configuredUrl && configuredUrl.length > 0 ? configuredUrl : undefined;
|
||||
|
||||
const serverUrl = import.meta.env.VITE_ROVERD_URL ?? "http://localhost:8080";
|
||||
export const socket = io({
|
||||
// export const socket = io(serverUrl, {
|
||||
transports: ["websocket"], // skip polling if your backend supports it
|
||||
query: {
|
||||
role: "user"
|
||||
}
|
||||
export const socket = io(serverUrl, {
|
||||
transports: ['websocket'],
|
||||
query: { role: 'user' },
|
||||
});
|
||||
|
||||
socket.on('connect_error', (error) => {
|
||||
console.error('Socket connection error:', error.message);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user