Socket.IO enables easy real-time two-way web communication and previously I mentioned the Objective-C Socket.IO client library SocketIO-Objc.
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 socket = client.socket("namespace")
// Set a delegate on socket
And this example shows the delgate function for handling events:
// 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.