pkyeck/socket.IO-objc — pull request #112 by mennopruijssers (2013-06-18 15:14:25+00:00)
Title: Add support for synchronous disconnect

I'm using the code (using the xhr transport) in an iPhone project. When the apps go to the background, I'm using beginBackgroundTaskWithExpirationHandler to keep the socket.io connection open in the background, allowing me to receive (for a limited time) events from the socket.io server.
When the background task is expiring I'm disconnecting the socket, calling endBackgroundTask in the socketIODidDisconnect-method of my delegate.

The problem with this scenario is that the package containing the disconnect isn't send before the background task is ended.

Using a sync-disconnect I make sure that the socket.io server 'knows' about the disconnect. (see the following socket.io specs: https://github.com/LearnBoost/socket.io-spec#forced-socket-disconnection).