Enhance socket service configuration for improved connection handling
This commit updates the socket service in both the backend and frontend to include explicit path and transport settings for Socket.IO. The backend configuration now allows for upgrades from polling to WebSocket, with defined timeouts for upgrades and pings. The frontend configuration adjusts the transport order and adds a timeout for reconnections, ensuring a more robust and efficient socket connection experience. These changes improve the reliability and performance of real-time communication in the application.
This commit is contained in:
@@ -13,10 +13,16 @@ export const connectSocket = (clubId) => {
|
||||
// Neue Verbindung erstellen
|
||||
// Verwende backendBaseUrl direkt, Socket.IO erkennt automatisch den Port
|
||||
socket = io(backendBaseUrl, {
|
||||
transports: ['websocket', 'polling'],
|
||||
path: '/socket.io/',
|
||||
transports: ['polling', 'websocket'], // Polling zuerst, dann Upgrade zu WebSocket
|
||||
reconnection: true,
|
||||
reconnectionDelay: 1000,
|
||||
reconnectionAttempts: 5
|
||||
reconnectionAttempts: 5,
|
||||
timeout: 20000,
|
||||
// Erlaube Upgrade von polling zu websocket
|
||||
upgrade: true,
|
||||
// Force new connection
|
||||
forceNew: false
|
||||
});
|
||||
|
||||
socket.on('connect', () => {
|
||||
|
||||
Reference in New Issue
Block a user