Websocket Connection Diagnosis
/**
- WebSocket Connection Troubleshooting Guide
- The connection errors show that the WebSocket is failing to connect to:
- wss://pipeline.aiqlick.com/ws/pipeline/{clientId}/?token={token}&EIO=4&transport=websocket
- This suggests a few possible issues:
-
- SERVER CONFIGURATION MISMATCH
-
- The server might not be a Socket.IO server
-
- It could be a plain WebSocket server expecting a different connection pattern
-
- The path structure /ws/pipeline/{clientId} suggests a custom WebSocket implementation
-
- AUTHENTICATION ISSUES
-
- The JWT token might be expired (check the exp field)
-
- The server might reject the token format
-
- The token might need to be passed differently
-
- NETWORK/FIREWALL ISSUES
-
- Corporate firewall blocking WebSocket connections
-
- Proxy interfering with WebSocket upgrade
-
- SSL/TLS certificate issues
-
- CLIENT CONFIGURATION ISSUES
-
- Wrong Socket.IO configuration for the server type
-
- Missing required headers or query parameters
-
- Incompatible Socket.IO version
- TROUBLESHOOTING STEPS:
-
- Test with plain WebSocket first:
-
- const ws = new WebSocket('wss://pipeline.aiqlick.com/ws/pipeline/test-client?token=your-token');
-
-
- Check if the server is actually a Socket.IO server:
-
- Socket.IO servers typically respond to /socket.io/ paths
-
- Try connecting to wss://pipeline.aiqlick.com/socket.io/
-
- Verify token validity:
-
- Decode the JWT token to check expiration
-
- Ensure the token has the required claims
-
- Test network connectivity:
-
- Use browser dev tools to inspect WebSocket frames
-
- Check for proxy interference
-
- Test from different networks
- RECOMMENDED FIXES:
-
- If it's a plain WebSocket server, create a custom WebSocket client
-
- If it's Socket.IO, fix the path configuration
-
- Add proper error handling and retry logic
-
- Implement connection state management */
export const WEBSOCKET_TROUBLESHOOTING = { COMMON_ISSUES: [ 'Server is not a Socket.IO server', 'Authentication token expired or invalid', 'Network/firewall blocking WebSocket connections', 'Incorrect client configuration' ], TESTING_STEPS: [ 'Test plain WebSocket connection', 'Verify Socket.IO server endpoint', 'Check token validity and format', 'Test network connectivity' ] };