Skip to content
Discussion options

You must be logged in to vote

For the browser client in your screenshot, the WebSocket HTTP response headers and the 101 Switching Protocols status are visible in DevTools, but the browser WebSocket API does not expose them to application JavaScript. Socket.IO cannot make those raw upgrade headers available through its browser client.

If you want to know when the transport becomes WebSocket, use the Engine.IO transport events exposed by the client:

socket.on('connect', () => {
  const engine = socket.io.engine;
  console.log('Current transport:', engine.transport.name);
  engine.on('upgrade', transport => {
    console.log('Upgraded to:', transport.name);
  });
});

This reports the transport, not the HTTP status or he…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by darrachequesne
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants