Skip to main content

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:
    1. 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
    1. 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
    1. NETWORK/FIREWALL ISSUES
    • Corporate firewall blocking WebSocket connections
    • Proxy interfering with WebSocket upgrade
    • SSL/TLS certificate issues
    1. CLIENT CONFIGURATION ISSUES
    • Wrong Socket.IO configuration for the server type
    • Missing required headers or query parameters
    • Incompatible Socket.IO version
  • TROUBLESHOOTING STEPS:
    1. Test with plain WebSocket first:
  • const ws = new WebSocket('wss://pipeline.aiqlick.com/ws/pipeline/test-client?token=your-token');
    1. 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/
    1. Verify token validity:
    • Decode the JWT token to check expiration
    • Ensure the token has the required claims
    1. Test network connectivity:
    • Use browser dev tools to inspect WebSocket frames
    • Check for proxy interference
    • Test from different networks
  • RECOMMENDED FIXES:
    1. If it's a plain WebSocket server, create a custom WebSocket client
    1. If it's Socket.IO, fix the path configuration
    1. Add proper error handling and retry logic
    1. 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' ] };