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

protocol(engine): Transport does not get updated when upgrade from WebSocket to WebTransport. #5324

Open
yhx-12243 opened this issue Apr 3, 2025 · 0 comments
Labels
to triage Waiting to be triaged by a member of the team

Comments

@yhx-12243
Copy link

yhx-12243 commented Apr 3, 2025

Describe the bug
Transport does not get updated when upgrade from WebSocket to WebTransport (when manually disable polling).

To Reproduce

Please fill the following code example:

Engine.IO server version: 6.6.4

Server

(Omitted, a correctly configured socket server with WebTransport enabled, see https://github.com/socketio/socket.io/blob/main/examples/webtransport/index.js)

Engine.IO client version: 6.6.3

Client

<!doctype html>
<html>
  <head>
    <meta charset="UTF-8">
    <title>Socket.IO WebTransport example</title>
  </head>
  <body>
    <script src="engine.io.js"></script>
    <script>
      const socket = new eio({
        transports: ['websocket', 'webtransport'],
        transportOptions: {
          websocket: { port: 1500 },
          webtransport: { port: 1650 },
        },
      });
    </script>
  </body>
</html>

Expected behavior
Subsequent request should sent by WebTransport.

Actual behavior
Image

engine.transport is still a WebSocket, marked upgrading = true, make it never success to sendmessage for both transports.

Additional context

In following code snippet, the callback in pause() would not be called if the original transport is WebSocket.

this.transport.pause(() => {
if (failed) return;
if ("closed" === this.readyState) return;
debug("changing transport and sending upgrade packet");
cleanup();
this.setTransport(transport);
transport.send([{ type: "upgrade" }]);
this.emitReserved("upgrade", transport);
transport = null;
this.upgrading = false;
this.flush();
});

@yhx-12243 yhx-12243 added the to triage Waiting to be triaged by a member of the team label Apr 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
to triage Waiting to be triaged by a member of the team
Projects
None yet
Development

No branches or pull requests

1 participant