{"action":"created","issue":{"url":"https://api.github.com/repos/kataras/iris/issues/595","repository_url":"https://api.github.com/repos/kataras/iris","labels_url":"https://api.github.com/repos/kataras/iris/issues/595/labels{/name}","comments_url":"https://api.github.com/repos/kataras/iris/issues/595/comments","events_url":"https://api.github.com/repos/kataras/iris/issues/595/events","html_url":"https://github.com/kataras/iris/issues/595","id":202456108,"number":595,"title":"Websocket hangs when calling iris.WebsocketConnection.Leave() on Disconnect","user":{"login":"antlaw","id":20368298,"avatar_url":"https://avatars.githubusercontent.com/u/20368298?v=3","gravatar_id":"","url":"https://api.github.com/users/antlaw","html_url":"https://github.com/antlaw","followers_url":"https://api.github.com/users/antlaw/followers","following_url":"https://api.github.com/users/antlaw/following{/other_user}","gists_url":"https://api.github.com/users/antlaw/gists{/gist_id}","starred_url":"https://api.github.com/users/antlaw/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/antlaw/subscriptions","organizations_url":"https://api.github.com/users/antlaw/orgs","repos_url":"https://api.github.com/users/antlaw/repos","events_url":"https://api.github.com/users/antlaw/events{/privacy}","received_events_url":"https://api.github.com/users/antlaw/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2017-01-23T06:33:12Z","updated_at":"2017-01-23T07:11:35Z","closed_at":null,"body":"- Version : **5.0.4**\r\n\r\n- Operating System: Windows 10\r\n\r\n- In an simple IRIS websocket server, if the server try to leave a room when it detects a websocket is disconnected, the websocket server will hang. The following is a code piece to illustrate the problem (It is not the exact code piece that  reproduces the problem, but it is a simplified version to demonstrate what I am talking about).\r\n\r\n- In the following code piece, if the line \"c.Join(\"server\")\" and \"c.Leave(\"server\")\" are there, once the program comes to c.Leave(\"server\"), the program will hang there and will not continue.\r\n\r\n- To me, a simple fix is, of course to avoid the line \"c.Leave(\"server\")\", but I think fixing WebsocketConnection.Leave() would make iris more robust.\r\n\r\n--------------\r\n\r\n// OnConnect handles incoming websocket connection\r\nfunc OnConnect(c iris.WebsocketConnection) {\r\n\tc.Join(\"server\")\r\n\tc.OnDisconnect(func() { OnDisconnect(c) })\r\n\r\n}\r\n\r\n// OnDisconnect clean up things when a client is disconnected\r\nfunc OnDisconnect(c iris.WebsocketConnection) {\r\n\tc.Leave(\"server\")\r\n}"},"comment":{"url":"https://api.github.com/repos/kataras/iris/issues/comments/274415291","html_url":"https://github.com/kataras/iris/issues/595#issuecomment-274415291","issue_url":"https://api.github.com/repos/kataras/iris/issues/595","id":274415291,"user":{"login":"kataras","id":2321588,"avatar_url":"https://avatars.githubusercontent.com/u/2321588?v=3","gravatar_id":"","url":"https://api.github.com/users/kataras","html_url":"https://github.com/kataras","followers_url":"https://api.github.com/users/kataras/followers","following_url":"https://api.github.com/users/kataras/following{/other_user}","gists_url":"https://api.github.com/users/kataras/gists{/gist_id}","starred_url":"https://api.github.com/users/kataras/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kataras/subscriptions","organizations_url":"https://api.github.com/users/kataras/orgs","repos_url":"https://api.github.com/users/kataras/repos","events_url":"https://api.github.com/users/kataras/events{/privacy}","received_events_url":"https://api.github.com/users/kataras/received_events","type":"User","site_admin":false},"created_at":"2017-01-23T07:11:35Z","updated_at":"2017-01-23T07:11:35Z","body":"Fixed "}}
{"actor":{"display_login":"kataras"}}