socketio / socket.io-admin-ui

Admin UI for Socket.IO
https://admin.socket.io
MIT License
358 stars 95 forks source link

TypeError: io.of is not a function when using namespace in websocket gateway #87

Open pooooriya opened 1 month ago

pooooriya commented 1 month ago

https://github.com/socketio/socket.io-admin-ui/blob/158864989dddeba67df9975a4cad48ef310f8c80/lib/index.ts#L543C32-L543C38

@WebSocketGateway(8080, { namespace: 'chat', cors: { origin: '*', credentials: true, }, })

afterInit() { instrument(this.server, { auth: false, mode: 'production', }); }

// error TypeError: io.of is not a function

how to fix : remove namespace from @websocketgateway

// correct way

@WebSocketGateway(8080, { cors: { origin: '*', credentials: true, }, })

pooooriya commented 1 month ago

i fix it

afterInit(nameSpace: Namespace) { instrument(nameSpace.server, { auth: false, mode: 'production', }); }

please add this to documantion

zyhnbyyds commented 1 month ago

i fix it

afterInit(nameSpace: Namespace) { instrument(nameSpace.server, { auth: false, mode: 'production', }); }

please add this to documantion

it works, thanks