title: Socket.io disconnect error
body: <p>I'm using socket.io-obj library from <a href="https://github.com/pkyeck/socket.IO-objc" rel="nofollow">https://github.com/pkyeck/socket.IO-objc</a> based on iOS7, but i found when the socket disconnect the server caused by the bad network environment, my application would be hang for a long time. 
  Here is my code:</p>
  
  <pre><code>#define NOTE_CENTER [NSNotificationCenter defaultCenter]
  -(void)connectServer
  {
      [socketIO connectToHost:SOCKETADDRESS
                       onPort:SOCKETPORT
                   withParams:nil
       ];
      status = Connecting;
      NSLog(@"%@",socketIO.debugDescription);
      [[] postNotificationName:kConnectingServer object:nil];
  }
  
  -(void)disConnectServer
  {
      [socketIO disconnect];
  }
  
  -(BOOL)hasConnected {
      if (status==Connected) {
          return true;
      }
      return false;
  }
  -(NetworkStatus)networkStatus
  {
      return status;
  }
  
  -(void) sendEvent:(OrderEvent)eventIndex withData:(NSDictionary *)data
  {
      if (status==Connected) {
          [socketIO sendEvent:@"close" withData:data];
          //[socketIO sendEvent:[NSString stringWithFormat:@"%lu",eventIndex] withData:data];
      }
  }
  
  -(void) sendEventWithName:(NSString*)eventName withData:(NSDictionary *)data
  {
      if (status==Connected) {
          [socketIO sendEvent:eventName withData:data];
      }
  }
  #pragma socketIO Delegate methods
  - (void) socketIODidConnect:(SocketIO *)socket
  {
      status = Connected;
      [NOTE_CENTER postNotificationName:kConnectedServer object:nil];
  }
  
  - (void) socketIODidDisconnect:(SocketIO *)socket disconnectedWithError:(NSError *)error
  {
      status = OffLine;
      NSLog(@"socket.io disconnected. did error occur? %@", error);
      [NOTE_CENTER postNotificationName:kDisConnectedServer object:nil];
  }
  
  - (void) socketIO:(SocketIO *)socket onError:(NSError *)error
  {
      [socket  disconnectForced];
      [NOTE_CENTER postNotificationName:kConnecteServerError object:nil];
      if ([error code] == SocketIOUnauthorized) {
          NSLog(@"not authorized");
      } else {
          NSLog(@"onError() %@", error);
      }
  }
  
  - (void) socketIO:(SocketIO *)socket didReceiveJSON:(SocketIOPacket *)packet
  {
  }
  
  - (void) socketIO:(SocketIO *)socket didReceiveEvent:(SocketIOPacket *)packet
  {
      NSLog(@"didReceiveEvent()");
      // test acknowledge
      NSString *packName = [packet name];
      //if (packet.name) {
      [NOTE_CENTER postNotificationName:packName object:nil userInfo:[[NSDictionary alloc] initWithObjectsAndKeys:[packet data],@"data", nil]];
      //}
      /*
      SocketIOCallback cb = ^(id argsData) {
          NSDictionary *response = argsData;
          // do something with response
          NSString *packetName = [response  stringValueForKey:@"name"];
          [NOTE_CENTER postNotificationName:packetName object:nil userInfo:response];
      };*/
  }
  </code></pre>
  
  <p>Another problem i occurred is when i call "[socketIO disconnect]" , the server will not disconnect my application immediately. Please help me find the answer for these issue.</p>
  
  <p>Big Thanks. </p>