{"action":"created","issue":{"url":"https://api.github.com/repos/nuclearace/Socket.IO-Client-Swift/issues/32","labels_url":"https://api.github.com/repos/nuclearace/Socket.IO-Client-Swift/issues/32/labels{/name}","comments_url":"https://api.github.com/repos/nuclearace/Socket.IO-Client-Swift/issues/32/comments","events_url":"https://api.github.com/repos/nuclearace/Socket.IO-Client-Swift/issues/32/events","html_url":"https://github.com/nuclearace/Socket.IO-Client-Swift/issues/32","id":64575809,"number":32,"title":"Crashes on reconnection","user":{"login":"osgafarov","id":2556134,"avatar_url":"https://avatars.githubusercontent.com/u/2556134?v=3","gravatar_id":"","url":"https://api.github.com/users/osgafarov","html_url":"https://github.com/osgafarov","followers_url":"https://api.github.com/users/osgafarov/followers","following_url":"https://api.github.com/users/osgafarov/following{/other_user}","gists_url":"https://api.github.com/users/osgafarov/gists{/gist_id}","starred_url":"https://api.github.com/users/osgafarov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/osgafarov/subscriptions","organizations_url":"https://api.github.com/users/osgafarov/orgs","repos_url":"https://api.github.com/users/osgafarov/repos","events_url":"https://api.github.com/users/osgafarov/events{/privacy}","received_events_url":"https://api.github.com/users/osgafarov/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-03-26T16:39:09Z","updated_at":"2015-03-26T17:01:15Z","closed_at":null,"body":"Hi,\r\n\r\nI am using Socket.IO-Client-Swift in a project written in Objective-C. I still support iOS 7.1\r\n\r\nI encounter one crash on line 291 in SocketEngine.swift\r\n\r\n\r\n\r\n        if self.connected {\r\n\r\n            assert(false, \"We're in a bad state, this shouldn't happen.\") //crashes here\r\n        }\r\n\r\nSteps to reproduce:\r\n1. Go to first screen of the app. Open a socket connection.\r\n2. Lock the screen of the device for 20-30 seconds.\r\n3. Unlock the screen and quickly navigate away from the current view controller of the app to another view controller. This will call socket.close()\r\n4. In a few seconds the socket library tries to reconnect and then it goes to this \"bad\" state. \r\n\r\nDo you have any ideas guys how to fix it?\r\n\r\nThanks in advance."},"comment":{"url":"https://api.github.com/repos/nuclearace/Socket.IO-Client-Swift/issues/comments/86625370","html_url":"https://github.com/nuclearace/Socket.IO-Client-Swift/issues/32#issuecomment-86625370","issue_url":"https://api.github.com/repos/nuclearace/Socket.IO-Client-Swift/issues/32","id":86625370,"user":{"login":"nuclearace","id":1211049,"avatar_url":"https://avatars.githubusercontent.com/u/1211049?v=3","gravatar_id":"","url":"https://api.github.com/users/nuclearace","html_url":"https://github.com/nuclearace","followers_url":"https://api.github.com/users/nuclearace/followers","following_url":"https://api.github.com/users/nuclearace/following{/other_user}","gists_url":"https://api.github.com/users/nuclearace/gists{/gist_id}","starred_url":"https://api.github.com/users/nuclearace/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nuclearace/subscriptions","organizations_url":"https://api.github.com/users/nuclearace/orgs","repos_url":"https://api.github.com/users/nuclearace/repos","events_url":"https://api.github.com/users/nuclearace/events{/privacy}","received_events_url":"https://api.github.com/users/nuclearace/received_events","type":"User","site_admin":false},"created_at":"2015-03-26T17:01:15Z","updated_at":"2015-03-26T17:01:15Z","body":"With the new client there's a new close method. With Objective-C I think (I don't know Objective-C well) you'd call it like:\r\n\r\n```objective-c\r\n[socket closeWithFast:YES]\r\n```\r\n\r\nWhich basically has the client assume that the server gets the disconnect, and immediately calls the disconnect handler."}}