Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR TYPESCRIPT

socket.io handshake return error "Transport unknown"

// you must use same version socket.io between server and client

// socket client
const host: string = 'http://localhost:4000'
const socket: Socket = socketClient(host, {
  transports: ['websocket'],
  agent: true,
  withCredentials: true,
  timeout: 20000 * 2,
  reconnectionDelayMax: 5000 * 2,
  reconnectionDelay: 1000 * 5
})

// socket server
this.io = new SocketServer(this.server, {
  cors: { origin: '*', credentials: true },
  allowEIO3: true,
  maxHttpBufferSize: 1000000,
  pingTimeout: 20000 * 2,
  pingInterval: 25000 * 2,
  upgradeTimeout: 10000 * 2,
  transports: ['websocket']
 })
 
PREVIOUS NEXT
Tagged: #handshake #return #error
ADD COMMENT
Topic
Name
1+6 =