{"action":"created","issue":{"url":"https://api.github.com/repos/nikeee/node-ts/issues/9","labels_url":"https://api.github.com/repos/nikeee/node-ts/issues/9/labels{/name}","comments_url":"https://api.github.com/repos/nikeee/node-ts/issues/9/comments","events_url":"https://api.github.com/repos/nikeee/node-ts/issues/9/events","html_url":"https://github.com/nikeee/node-ts/issues/9","id":61741657,"number":9,"title":"Events Example","user":{"login":"SirWilli","id":5961995,"avatar_url":"https://avatars.githubusercontent.com/u/5961995?v=3","gravatar_id":"","url":"https://api.github.com/users/SirWilli","html_url":"https://github.com/SirWilli","followers_url":"https://api.github.com/users/SirWilli/followers","following_url":"https://api.github.com/users/SirWilli/following{/other_user}","gists_url":"https://api.github.com/users/SirWilli/gists{/gist_id}","starred_url":"https://api.github.com/users/SirWilli/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SirWilli/subscriptions","organizations_url":"https://api.github.com/users/SirWilli/orgs","repos_url":"https://api.github.com/users/SirWilli/repos","events_url":"https://api.github.com/users/SirWilli/events{/privacy}","received_events_url":"https://api.github.com/users/SirWilli/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":19,"created_at":"2015-03-15T04:04:02Z","updated_at":"2015-03-25T16:08:55Z","closed_at":null,"body":"hey,\r\n\r\ncould you show me an example for events? I don't understand how to use them. (in node.js)"},"comment":{"url":"https://api.github.com/repos/nikeee/node-ts/issues/comments/86097706","html_url":"https://github.com/nikeee/node-ts/issues/9#issuecomment-86097706","issue_url":"https://api.github.com/repos/nikeee/node-ts/issues/9","id":86097706,"user":{"login":"SirWilli","id":5961995,"avatar_url":"https://avatars.githubusercontent.com/u/5961995?v=3","gravatar_id":"","url":"https://api.github.com/users/SirWilli","html_url":"https://github.com/SirWilli","followers_url":"https://api.github.com/users/SirWilli/followers","following_url":"https://api.github.com/users/SirWilli/following{/other_user}","gists_url":"https://api.github.com/users/SirWilli/gists{/gist_id}","starred_url":"https://api.github.com/users/SirWilli/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SirWilli/subscriptions","organizations_url":"https://api.github.com/users/SirWilli/orgs","repos_url":"https://api.github.com/users/SirWilli/repos","events_url":"https://api.github.com/users/SirWilli/events{/privacy}","received_events_url":"https://api.github.com/users/SirWilli/received_events","type":"User","site_admin":false},"created_at":"2015-03-25T16:08:55Z","updated_at":"2015-03-25T16:08:55Z","body":"The issue is probably in this clientmoved event as this is the last thing I added. Also the disconnect happens after the second clientmove.\r\n```javascript\r\n\r\n    cl.on(\"clientmoved\", function(data) {\r\n        var channel = data[0].ctid;\r\n\r\n        if (last[0].ctid != channel && config.channels.hasOwnProperty(channel)) {\r\n            if (containsChannel(createdChannels, channel)) {\r\n                last = data;\r\n                var found = false;\r\n                console.log(true)\r\n                cl.send(\"channellist\").then(function(info) {\r\n                    var channellist = info.response;\r\n\r\n                    channelInfo(channel).then(function(channelinfo) {\r\n\r\n                        channellist.forEach(function(entry) {\r\n                            if (entry.pid == channelinfo[0].pid) {\r\n                                if(entry.total_clients == 0) {\r\n                                    found = true;                               \r\n                                }\r\n\r\n                            }\r\n                        });\r\n\r\n                    });\r\n                });\r\n\r\n                if (!found) {\r\n                    createChannel(data); //this function was there before the issue\r\n                }\r\n            }\r\n        }\r\n    });\r\n```"}}