Swift with Socket.IO w00t

swift and socket io

I wanted to create a auctions app, and for that i need realtime data from a socket io server. So i was googling, and yes there was a socket io lib for swift and java (android), and thats really nice.


So i included the socket io client in a podfile and linked the library in swift. Finally i configure socket io in my viewDidLoad func.

  let socket = SocketIOClient(socketURL: NSURL(string: Config.socketIOUrl)!, options: [.Log(false), .ForcePolling(true), .Secure(true)])

And i did this in my business logic:

 self.socket.on("bid_message_\(veiling_id)") { data2,ack2 in

And it was working like a charm.

How nice is that 🙂

Very soon i will start the same app for Android, lets see how that works out 🙂

Leave a Reply