Closed hokie closed 4 years ago
It sounds like you're trying to send messages to connected clients when a connection is established?
Have you tried emitting from the client on your connection handler?
client.emit(...)
in your handleConnection
@joeyslack - I have tried calling client.emit('test', 'test') from inside my handleConnection function and had no luck. HOWEVER, when I use client.send('test', 'test'), the message is received by my client.
handleConnection(client: any, ...args: any[]): any {
console.log('Connection detected');
client.send('events', 'this is a test thing to see what happens');
}
Is this related to #3390
Please, provide a minimal repository which reproduces your issue.
@hokie isn't namespace
socket.io related feature?
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.
Bug Report
Current behavior
Using WsAdapter, I am successfully connecting to the WebSocketGateway from the client, but messages aren't being emitted when calling emit() from the handleConnection() function. I am also able to successfully disconnect from the gateway using client. No errors are being thrown from either the client or Nest app.
Input Code
main.ts
test.gateway.ts
client harness
Expected behavior
Expect Nest gateway to emit message to client, and message to be logged to client console.
Environment