Skip to content

Cannot establish polling connection #79

@hatsuroku

Description

@hatsuroku

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions