Closed
Description
Link to the code that reproduces this issue or a replay of the bug
https://codesandbox.io/p/sandbox/nextjs-socketio-forked-39xjkv?file=/app/page.jsx:1,1
To Reproduce
- Open the above code sandbox
- open dev tools
- you will see a console message like
Connected 3JVo-y0FEk3lIPAkAAAP with polling
- network tools shows a ton of /api/my_awesome_socket/?EIO=4&transport=polling calls
Current vs. Expected behavior
After the Connected 3JVo-y0FEk3lIPAkAAAP with polling
message, eventually there should be a Upgraded from polling to websocket
message, but this never happens even though the expected 101 Switching Protocols
shows in the network tab.
Instead, it just stays at http polling transport, with additional calls going out.
Verify canary release
- I verified that the issue exists in the latest Next.js canary release
Provide environment information
Operating System:
Platform: linux
Arch: x64
Version: #1 SMP Fri Jan 27 02:56:13 UTC 2023
Binaries:
Node: 18.16.1
npm: 9.5.1
Yarn: 3.6.1
pnpm: 8.5.1
Relevant Packages:
next: 13.4.20-canary.26
eslint-config-next: N/A
react: 18.2.0
react-dom: 18.2.0
typescript: 5.1.6
Next.js Config:
output: N/A
Which area(s) are affected? (Select all that apply)
Not sure
Additional context
The fix for #49334 introduced this issue.
Might be worth looking at this part of Socket.io's docs: https://socket.io/docs/v4/troubleshooting-connection-issues/#problem-the-socket-is-stuck-in-http-long-polling
We might also need the changes that were in this abandoned PR: #54502