I am using socket.io with my swift iOS app. Occasionally my socket connection is dropped.
How can I check the status of the connection so that I may re-connect if it is not connected? I couldn't find any commands for checking the status of the connection in the client API documents.
I'm using iOS 11 with swift 4.
Swift 4:
let socketConnectionStatus = socket.status
switch socketConnectionStatus {
case SocketIOStatus.connected:
print("socket connected")
case SocketIOStatus.connecting:
print("socket connecting")
case SocketIOStatus.disconnected:
print("socket disconnected")
case SocketIOStatus.notConnected:
print("socket not connected")
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With