Unable to resolve identifier socketmanager with (swift3 xcode9 iOS)

441 Views Asked by At

I am trying to implement Socket.IO-Client-Swift using this socket.io library. But due to this error Unable to resolve identifier socketmanager I am unable to implement this library. I am using xcode 9 and swift 3.2.2.

    let manager = SocketManager(socketURL: URL(string: "http://localhost:8080")!, config: [.log(true), .compress])
    let socket = manager.defaultSocket

    socket.on(clientEvent: .connect) {data, ack in
        print("socket connected")
    }

    socket.on("client balance change") {data, ack in

        guard let cur = data[0] as? Double else { return }
        socket.emitWithAck("canUpdate", cur).timingOut(after: 0) {data in
            socket.emit("update", ["amount": cur + 2.50])
        }
        ack.with("Got your currentAmount", "dude")

    }

    socket.connect()
1

There are 1 best solutions below

0
On

Replace SocketManager with this

let socket: SocketIOClient = SocketIOClient(socketURL: NSURL(string: "http://localhost:8080")! as URL)