Skip to content

Instantly share code, notes, and snippets.

@jzucker2
Last active November 9, 2017 21:55
Show Gist options
  • Save jzucker2/ed08902cb5ec55b645f9e582ad027e30 to your computer and use it in GitHub Desktop.
Save jzucker2/ed08902cb5ec55b645f9e582ad027e30 to your computer and use it in GitHub Desktop.
// the idea behind this is to make sure we establish an SSL connection with all 3 pubnub non-subscribe connections
// this is to try and get all three connections to be established right away. Running this frequently won't make things
// better, it just needs to run whenever the app becomes active
func establishSSL() {
DispatchQueue.concurrentPerform(iterations: 10) { (_) in
self.client.publish("Establish all 3 ssl connections", toChannel: "AnyChannel", withCompletion: { (status) in
print("We just published with: \(status.debugDescription)")
})
}
}
// I'd put this in your AppDelegate.swift like below:
func applicationDidBecomeActive(_ application: UIApplication) {
// Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
establishSSL()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment