{"action":"created","issue":{"url":"https://api.github.com/repos/expressjs/express/issues/3637","repository_url":"https://api.github.com/repos/expressjs/express","labels_url":"https://api.github.com/repos/expressjs/express/issues/3637/labels{/name}","comments_url":"https://api.github.com/repos/expressjs/express/issues/3637/comments","events_url":"https://api.github.com/repos/expressjs/express/issues/3637/events","html_url":"https://github.com/expressjs/express/issues/3637","id":318724318,"number":3637,"title":"Send response from outside route","user":{"login":"gijo-varghese","id":23092846,"avatar_url":"https://avatars1.githubusercontent.com/u/23092846?v=4","gravatar_id":"","url":"https://api.github.com/users/gijo-varghese","html_url":"https://github.com/gijo-varghese","followers_url":"https://api.github.com/users/gijo-varghese/followers","following_url":"https://api.github.com/users/gijo-varghese/following{/other_user}","gists_url":"https://api.github.com/users/gijo-varghese/gists{/gist_id}","starred_url":"https://api.github.com/users/gijo-varghese/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gijo-varghese/subscriptions","organizations_url":"https://api.github.com/users/gijo-varghese/orgs","repos_url":"https://api.github.com/users/gijo-varghese/repos","events_url":"https://api.github.com/users/gijo-varghese/events{/privacy}","received_events_url":"https://api.github.com/users/gijo-varghese/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":4,"created_at":"2018-04-29T15:07:33Z","updated_at":"2018-04-29T16:08:51Z","closed_at":"2018-04-29T15:17:11Z","author_association":"NONE","body":"I've route `'/endpoint'` that accept a request, send it to a WebSocket client, and wait for its response. Is it possible to send the response outside the route function?\r\n\r\n\r\n```\r\nio.on('connection', (socket) => {\r\n    socket.on('res', (data) => {\r\n        console.log(data)\r\n         // response event received. lets send back to /endpoint\r\n    });\r\n});\r\n\r\napp.get('/endpoint', (req, res) => {\r\n    io.emit('req', { data: 'hello' });\r\n   // wait for event 'res' in socket io \r\n});\r\n```\r\n\r\nStackoverflow:\r\nhttps://stackoverflow.com/questions/50087400/forward-request-to-ws-client-and-wait-for-response-express/50087724"},"comment":{"url":"https://api.github.com/repos/expressjs/express/issues/comments/385262059","html_url":"https://github.com/expressjs/express/issues/3637#issuecomment-385262059","issue_url":"https://api.github.com/repos/expressjs/express/issues/3637","id":385262059,"user":{"login":"dougwilson","id":67512,"avatar_url":"https://avatars3.githubusercontent.com/u/67512?v=4","gravatar_id":"","url":"https://api.github.com/users/dougwilson","html_url":"https://github.com/dougwilson","followers_url":"https://api.github.com/users/dougwilson/followers","following_url":"https://api.github.com/users/dougwilson/following{/other_user}","gists_url":"https://api.github.com/users/dougwilson/gists{/gist_id}","starred_url":"https://api.github.com/users/dougwilson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dougwilson/subscriptions","organizations_url":"https://api.github.com/users/dougwilson/orgs","repos_url":"https://api.github.com/users/dougwilson/repos","events_url":"https://api.github.com/users/dougwilson/events{/privacy}","received_events_url":"https://api.github.com/users/dougwilson/received_events","type":"User","site_admin":false},"created_at":"2018-04-29T16:08:51Z","updated_at":"2018-04-29T16:08:51Z","author_association":"OWNER","body":"Just come by Stackoverflow or Gitter for support help."}}
{"actor":{"display_login":"dougwilson"}}