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

Aperta
#87 2 commenti 1 reazione 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
35/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Ferma
Stack tecnologico
node.js, typescript
Ambito
backend

Direzione di ricerca

The issue links to lib/index.ts at line 543, where io.of is called, and shows a NestJS @WebSocketGateway configured with a namespace. Start by reading that call and the surrounding instrumentation code, then check how the gateway passes its server when a namespace is set. Done means namespace configuration no longer triggers the reported TypeError, with the behavior covered by a test.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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

Lingua principale
Vue
Stelle
413
Fork
109
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Preparare l'ambiente

  • Include un Dockerfile o un file Docker Compose
  • Nessun modello di pull request
  • Nessuna guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di socketio/socket.io-admin-ui

Tutte le issue di socketio/socket.io-admin-ui

Issue simili

Altre issue su Backend & API Design

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.