socket.io icon indicating copy to clipboard operation
socket.io copied to clipboard

Not work with ujs/nitro

Open imcm7 opened this issue 2 years ago • 1 comments

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);
})

imcm7 avatar Dec 08 '23 09:12 imcm7

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.

imcm7 avatar Dec 08 '23 10:12 imcm7

For future readers:

Please check our Nuxt guide: https://socket.io/how-to/use-with-nuxt

darrachequesne avatar Mar 27 '24 16:03 darrachequesne