Get Updates By E-mail 

Article Written By:
Johann Dowa

Open Source Library Providing A Swift Based Socket.IO Client LIbrary


Socket.IO enables easy real-time two-way web communication and previously I mentioned the Objective-C Socket.IO client library SocketIO-Objc.

More recently I’ve also mentioned the Swift based websockets library Starscream and the Swift based HTTP networking library AlamoFire.

Here’s an open source project submitted by Shuo Li providing a Swift based Socket.IO client library that utilizes the Starscream and AlamoFire libraries called SocketIOCocoa.

This source code example from the readme shows how to create a client, and socket:

var client = SocketIOClient(uri: uri, reconnect: true, timeout: 30)

var socket = client.socket("namespace")
// Set a delegate on socket

And this example shows the delgate function for handling events:

@objc public protocol SocketIOSocketDelegate {
    // Called when the socket received a low level packet
    optional func socketOnPacket(socket: SocketIOSocket, packet: SocketIOPacket)

<pre><code>// Called when the socket received an event
func socketOnEvent(socket: SocketIOSocket, event: String, data: AnyObject?)

// Called when the socket is open
func socketOnOpen(socket: SocketIOSocket)

// Called when the socket is on error
func socketOnError(socket: SocketIOSocket, error: String, description: String?)


You can find SocketIOCocoa on Github here.

A nice Socket.IO client library created in Swift.


Submit A Resource

Have you created a useful tutorial, library or tool for iOS development that you would like to get in front of our 300,000+ monthly page views from iOS developers?

You can submit the url here.

The resources we feel will appeal to our readers the most will be posted on the front page.