Skip to content
New issue

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

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

Already on GitHub? # to your account

socket.io fails to load #134

Open
johntom opened this issue May 17, 2024 · 1 comment
Open

socket.io fails to load #134

johntom opened this issue May 17, 2024 · 1 comment

Comments

@johntom
Copy link

johntom commented May 17, 2024

Hi,
I'm trying to port a fastify3 to fastify4 and can't seem to get socket.io working.

  1. Code base works with the following
    fastify 3 "fastify": "^3.29.0"
    "@guivic/fastify-socket.io": "^0.1.3"
  2. I have websockets working with fastify4
  3. I built a small repo that raises the following errors

from postmam
Could not connect to http://127.0.0.1:8080/apiSIO/hello-socketio Error: Unexpected server response: 404
fastify log
{"level":30,"time":1715895572624,"pid":35768,"hostname":"BGR-LT-37BG3Y2","reqId":"req-1","req":{"method":"GET","url":"/socket.io/?EIO=4&transport=websocket","hostname":"127.0.0.1:8080","remoteAddress":"127.0.0.1","remotePort":61309},"msg":"incoming request"} {"level":30,"time":1715895572625,"pid":35768,"hostname":"BGR-LT-37BG3Y2","reqId":"req-1","msg":"Route GET:/socket.io/?EIO=4&transport=websocket not found"}

error from SPA (aurelia 1.5)
// error on client GET http://localhost:8080/socket.io/?EIO=4&transport=polling&t=OzzR0IF 404 (Not Found) index.js:74 message xhr poll error index.js:76 description 404 index.js:78 context XMLHttpRequest...

I've tried numerous config changes but have not succeeded.

https://github.com/johntom/F4Staging.git

@flav-code
Copy link

hello, try to set in fastify option host: "127.0.0.1" it should fixe the issue

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

No branches or pull requests

2 participants