{"action":"opened","issue":{"url":"https://api.github.com/repos/websocket-rails/websocket-rails/issues/339","labels_url":"https://api.github.com/repos/websocket-rails/websocket-rails/issues/339/labels{/name}","comments_url":"https://api.github.com/repos/websocket-rails/websocket-rails/issues/339/comments","events_url":"https://api.github.com/repos/websocket-rails/websocket-rails/issues/339/events","html_url":"https://github.com/websocket-rails/websocket-rails/issues/339","id":77132270,"number":339,"title":"How to handle 'client_disconnected'","user":{"login":"utkuDAT","id":3123846,"avatar_url":"https://avatars.githubusercontent.com/u/3123846?v=3","gravatar_id":"","url":"https://api.github.com/users/utkuDAT","html_url":"https://github.com/utkuDAT","followers_url":"https://api.github.com/users/utkuDAT/followers","following_url":"https://api.github.com/users/utkuDAT/following{/other_user}","gists_url":"https://api.github.com/users/utkuDAT/gists{/gist_id}","starred_url":"https://api.github.com/users/utkuDAT/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/utkuDAT/subscriptions","organizations_url":"https://api.github.com/users/utkuDAT/orgs","repos_url":"https://api.github.com/users/utkuDAT/repos","events_url":"https://api.github.com/users/utkuDAT/events{/privacy}","received_events_url":"https://api.github.com/users/utkuDAT/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-05-16T21:05:27Z","updated_at":"2015-05-16T21:05:27Z","closed_at":null,"body":"Hi guys,\r\nI know, when user disconnected, 'client_disconnected' action will be fire up. I can handle it inside controller. \r\nI have a user list on my chat room. I want to remove disconnected users from user list. I tried to trigger client inside client_disconnected action but it does not work. Could you please help me with this issue ? \r\nThank you\r\nBest regards.\r\n\r\nclient\r\n```javascript\r\ndispatcher.bind('client_disconnected', function(data) {\r\n        public_channel.trigger('client_disconnected', data);\r\n    });\r\n    public_channel.bind('client_disconnected', function(current_user){\r\n       alert(1);\r\n    });\r\n```\r\n\r\ncontroller\r\n```\r\ndef client_disconnected\r\n        send_message :client_disconnected, current_user\r\n        ap \"user_disconnected\"\r\nend\r\n```\r\n\r\nevents.rb\r\n```\r\nsubscribe :client_disconnected, :to => ChatController, :with_method => :client_disconnected\r\n```"}}