title: Implement socket.io-client in swift
body: <p>I am trying to implement socket.io-client in swift. It is not working as supposed. I am unable to read any response from the server on my request. My socket is connecting but after that, I am unable to call events and getting their response.
   Swift 4, Xcode 10</p>
  
  <p>I am using a global class to declare socket functions as 'clsGlobal' and calling socket functions in different viewcontrollers. </p>
  
  <p>import Foundation
  import UIKit
  import SocketIO</p>
  
  <p>class clsSocket: NSObject {</p>
  
  <pre><code>let appdelegate = UIApplication.shared.delegate as! AppDelegate
  
  static var manager = SocketManager(socketURL: URL(string: "my url")!, config: [.log(true), .reconnects(true)])
  static var socket = manager.defaultSocket
  
  static func ConnectSocket(){
  
  
      socket.connect()
      print(socket.status)
  
      socket.on("locationsUpdate", callback: { data,ack in
          print(data)
          let resp = data[0] as! Any
          print(resp)
      })
  }
  static func updateLocation(dId:NSNumber, uId:NSNumber, distance:Double){
      let datafield : [String:Any] = ["id":dId,
                                      "userid": uId,
                                      "travelledDistance":distance
      ]
      let data = try? JSONSerialization.data(withJSONObject: datafield)
      if socket.status == .connected {
          socket.emit("updateLocation",  data!)
          socket.emit("requestLocations")
      }
  
  }
  static func dogDisconnect(dogid:NSNumber, userid:NSNumber){
      let datafield = ["dId":did, "uId":userid]
      let dataobj = try? JSONSerialization.data(withJSONObject: datafield)
      socket.emit("disconnect",  dataobj!)
      socket.disconnect()
      socket.off("requestLocations")
  }
  </code></pre>
  
  <p>}</p>
  
  <p>How to know if the server is connected and how to print response from server?</p>