socket.io
socket.io copied to clipboard
Not work with ujs/nitro
Describe the bug
GET http://localhost:3000/socket.io/?EIO=4 (Cannot find any route matching /socket.io/?EIO=4)
To Reproduce
Install nitro and add plugin
import { Server as CreateServer } from 'node:http';
import { Server, Socket } from '../socket.io';
export default defineNitroPlugin((nitroApp) => {
const server = new CreateServer(toNodeListener(nitroApp.h3App));
const io = new Server(server);
})
And people do something like
https://github.com/adityar15/nuxt3socket/tree/master/server https://stackoverflow.com/questions/73592619/socket-io-websocket-not-working-in-nuxt-3-when-in-production
or use const io = new Server(); without passing of srv.
For future readers:
Please check our Nuxt guide: https://socket.io/how-to/use-with-nuxt