I'm trying to build a chat application, but I do know how to integrate socket I/O in Swift. I am following this tutorial.
- I'm adding a POD file
- Open xcodeworkspace file
- Import sockekIO file
This is my code image I am getting like this error
How do I know my socketIO connected to the server? I am not sure.
import UIKit
import SocketIO
class ViewController: UIViewController {
override func viewDidLoad() {
let socket = SocketIOClient(socketURL: NSURL(string: "http://localhost:8080")!)
socket.on("connect") { _, _ in
print("socket connected")
socket.emit("ping", "data")
}
socket.on("ping") { _, _ in
print("ping received")
}
socket.connect()
}
}