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

Cannot establish polling connection #79

Open
hatsuroku opened this issue Dec 16, 2022 · 4 comments
Open

Cannot establish polling connection #79

hatsuroku opened this issue Dec 16, 2022 · 4 comments

Comments

@hatsuroku
Copy link

hatsuroku commented Dec 16, 2022

I'm using Firefox (108.0, MacOS 13.1).
When I run this project, the browser debugger shows there's some 500 responses from the server.
图片
I added this code to the index.js, and the server console logs:

io.engine.on("connection_error", (err) => {
  // console.log(err.req);      // the request object
  console.log(err.code);     // the error code, for example 1
  console.log(err.message);  // the error message, for example "Session ID unknown"
  console.log(err.context);  // some additional error context
});

图片

I guess the problem is: the websocket connection was established successfully, but the polling connection failed.
So I tried to add a parameter to allow only polling:

const io = require('socket.io')(http, {
  transports: ['polling']
});

Then, the connection never establishes successfully. The browser sends requests and gets 500 responses infinitely. The server also gets "Session ID unknown" infinitely.
图片
图片

Looks like a new connection starts to establish when the previous connection hasn't finished establishing.

I've tried the latest version (4.5.4) of "socket.io" and "socket.io-client", the behavior is the same.
And I found the polling connection can be successfully established in the latest version of Chrome, but failed in Edge as in Firefox.

How can I solve this?

@hatsuroku
Copy link
Author

hatsuroku commented Dec 16, 2022

Except the code showed above, the rest of the code is exactly the same as the repositories.

@hatsuroku
Copy link
Author

hatsuroku commented Dec 16, 2022

Edge (108.0.1462.54, windows 11 22H2)

image
image

@hatsuroku
Copy link
Author

hatsuroku commented Dec 16, 2022

Chrome (108.0.5359.125, windows 11 22H2)
The connection is established successfully.
image

@darrachequesne
Copy link
Member

@hatsuroku were you able to find the cause of the issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants