Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Why engine.io never try the second transport #575

Open
1 of 2 tasks
SijieDingEsna opened this issue Jul 26, 2017 · 0 comments
Open
1 of 2 tasks

Why engine.io never try the second transport #575

SijieDingEsna opened this issue Jul 26, 2017 · 0 comments
Labels
bug Something isn't working

Comments

@SijieDingEsna
Copy link

SijieDingEsna commented Jul 26, 2017

Note: for support questions, please use one of these channels: stackoverflow or slack

You want to:

  • report a bug
    I have a socket.io server which apply socket.io + express and it only supports websocket. If transports is set as ['polling', 'websocket'] in client side, engine.io-client always try polling infinity and never try websocket.
  • request a feature

Current behaviour

Steps to reproduce (if the current behaviour is a bug)

Expected behaviour

Once the socket.io server side return status 400 and the payload is {"code":0,"message":"Transport unknown"}. The client side should be smart enough to try the second protocol. Because your document suggestion is polling is at first and the default transports is ['polling', 'websocket']. So I think under such transport setting of client, engine.io-client should be tolerable enough to handle such condition.

Setup

  • OS:
  • browser:
  • engine.io version:

Other information (e.g. stacktraces, related issues, suggestions how to fix)

@darrachequesne darrachequesne added the bug Something isn't working label Jun 4, 2020
darrachequesne added a commit to socketio/socket.io-admin-ui that referenced this issue May 9, 2021
darrachequesne added a commit that referenced this issue May 28, 2024
When setting the `tryAllTransports` option to `true`, if the first
transport (usually, HTTP long-polling) fails, then the other transports
will be tested too.

This is useful in two cases:

> when HTTP long-polling is disabled on the server, or if CORS fails

Related:

- #575
- socketio/socket.io-client#1448

> when WebSocket is tested first (`transports: ["websocket", "polling"])

Related:

- #714
- socketio/socket.io-client#1599

The only potential downside is that the connection attempt could take
more time in case of failure, as there have been reports of WebSocket
connection errors taking several seconds before being detected (that's
one reason for using HTTP long-polling first). That's why the option
defaults to `false` for now.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants