{"action":"closed","issue":{"url":"https://api.github.com/repos/nestjs/nest/issues/1096","repository_url":"https://api.github.com/repos/nestjs/nest","labels_url":"https://api.github.com/repos/nestjs/nest/issues/1096/labels{/name}","comments_url":"https://api.github.com/repos/nestjs/nest/issues/1096/comments","events_url":"https://api.github.com/repos/nestjs/nest/issues/1096/events","html_url":"https://github.com/nestjs/nest/issues/1096","id":361267060,"node_id":"MDU6SXNzdWUzNjEyNjcwNjA=","number":1096,"title":"Websocket handleConnection method: Emit to client not working here","user":{"login":"maxime1992","id":4950209,"node_id":"MDQ6VXNlcjQ5NTAyMDk=","avatar_url":"https://avatars0.githubusercontent.com/u/4950209?v=4","gravatar_id":"","url":"https://api.github.com/users/maxime1992","html_url":"https://github.com/maxime1992","followers_url":"https://api.github.com/users/maxime1992/followers","following_url":"https://api.github.com/users/maxime1992/following{/other_user}","gists_url":"https://api.github.com/users/maxime1992/gists{/gist_id}","starred_url":"https://api.github.com/users/maxime1992/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/maxime1992/subscriptions","organizations_url":"https://api.github.com/users/maxime1992/orgs","repos_url":"https://api.github.com/users/maxime1992/repos","events_url":"https://api.github.com/users/maxime1992/events{/privacy}","received_events_url":"https://api.github.com/users/maxime1992/received_events","type":"User","site_admin":false},"labels":[{"id":1026289724,"node_id":"MDU6TGFiZWwxMDI2Mjg5NzI0","url":"https://api.github.com/repos/nestjs/nest/labels/needs%20clarification","name":"needs clarification","color":"d6f25c","default":false}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2018-09-18T11:52:48Z","updated_at":"2018-09-24T08:54:57Z","closed_at":"2018-09-24T08:54:57Z","author_association":"NONE","body":"## I'm submitting a...\r\n<!-- \r\nPlease search GitHub for a similar issue or PR before submitting.\r\nCheck one of the following options with \"x\" -->\r\n<pre><code>\r\n[ ] Regression <!--(a behavior that used to work and stopped working in a new release)-->\r\n[ x ] Bug report\r\n[ ] Feature request\r\n[ ] Documentation issue or request\r\n[ ] Support request => Please do not submit support request here, instead post your question on Stack Overflow.\r\n</code></pre>\r\n\r\n## Current behavior\r\nWhen a client is connected to the backend through the WS I want to send some initial info.\r\n\r\nI thought that implementing `OnGatewayConnection` and from the method `handleConnection`; either returning what I want or using `client.emit('something')` would allow the client to get the event but it does not.\r\n\r\nUpdating\r\n\r\n```ts\r\nhandleConnection(client: any) {\r\n  client.emit('MY_EVENT', 'some value');\r\n}\r\n```\r\n\r\nTo\r\n```ts\r\nhandleConnection(client: any) {\r\n  setTimeout(() => {\r\n    client.emit('MY_EVENT', 'some value');\r\n  }, 1000)\r\n}\r\n```\r\n\r\nWorks and the client receives the event.\r\n\r\n## Expected behavior\r\nNo need for a `setTimeout`?\r\n\r\n\r\n## Environment\r\n\r\n<pre><code>\r\nNest version: 5.3.7\r\n \r\nFor Tooling issues:\r\n- Node version: 10.0.0\r\n- Platform:  Linux\r\n\r\n\r\nOthers:\r\nI've checked the WS through the network panel in Chrome, not just subscribing to the events that might get filtered or hidden somehow."}}
{"actor":{"display_login":"kamilmysliwiec"}}