Socket.connect() is not consistent when using connectParams with JWT Socket.connect() is not consistent when using connectParams with JWT ios ios

Socket.connect() is not consistent when using connectParams with JWT


I suggest you to use keychain like this:

let keychain = KeychainSwift()keychain.set("string", forKey: "key")keychain.get("key")keychain.delete("key")

keychain Usage:

let saveBool: Bool = KeychainWrapper.setString("String", forKey: "key")  let retrievedString: String? = KeychainWrapper.stringForKey("key")let removeBool: Bool = KeychainWrapper.removeObjectForKey("key")

And make sure that your token is set when calling establish connection, if not, don't try and connect.

References:

https://github.com/socketio/socket.io-client-swift/issues/788

https://github.com/marketplacer/keychain-swift

https://github.com/jrendel/SwiftKeychainWrapper

More info:

JSON Web Token is a JSON-based open standard for creating access tokens that assert some number of claims.