Closed Loriot-n closed 6 years ago
Do you maybe have 2 Gateways with the same namespace configuration? (or maybe no namespace configured at all)
Indeed, I didn't configure any namespaces. But this is the only WebSocketGateway
in my application 🤔
Configuring a namespace (even if I don't need one) could resolve the issue?
I doubt it. I had the same issue but 2 gateways on the same namespace
Sorry, I made a mistake, in my app.module.ts
I imported my ws.gateway and my ws.module
So it was instantiated twice !
Thanks for the help @BorntraegerMarc
I'm actually encountering the same issue. In app.module.ts :
import { Module } from '@nestjs/common';
import { ConnectionsModule } from './connections/connections.module';
@Module({
imports: [ConnectionsModule],
})
export class AppModule {}
import { Module } from '@nestjs/common';
import { ConnectionsGateway } from './connections.gateway';
@Module({
providers: [ConnectionsGateway],
})
export class ConnectionsModule {}
And ConnectionsGateway implements OnGatewayConnection, without namespace.
The connection event is getting fired twice. If I provide a namespace
, the event is fired only once. Not sure if it's me, or a bug in the package while not using a namespace
I'm actually encountering the same issue. but it is not resolved.
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
I'm submitting a...
Current behavior
WebSocketGateway methods fire twice for each events / connection Note sure if this is expected but this could be problematic in many cases
Expected behavior
Fire only one event
Minimal reproduction of the problem with instructions
server
client : based on sample-2
Logs from the server :
What is the motivation / use case for changing the behavior?
Environment