socketio/socket.io-client-swift
socketio/socket.io-client-swift has 5,288 GitHub stars and 869 forks. GitHot measured 0 stars in 24 hours. Last checked 2026-11-06 15:28 UTC. Last push 2024-10-01.
Checkout the 12to13 guide for migrating to v13+ from v12 below.
What you can do
- Supports Socket.IO server 2.0+/3.0+/4.0+ (see the compatibility table)
- Supports Binary
- Supports Polling and WebSockets
- Supports TLS/SSL
Measured star growth
- in 24h
- 0
- in 7 days
- Collecting history
- in 15 days
- Collecting history
- in 1 month
- Collecting history
Net star changes over overlapping periods, not daily totals. Missing measurements are left blank. Stars measure attention, not software quality.
README.md
OriginalSocket.IO-Client-Swift
Socket.IO-client for iOS/OS X.
Example
import SocketIO
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("currentAmount") {data, ack in
guard let cur = data[0] as? Double else { return }
socket.emitWithAck("canUpdate", cur).timingOut(after: 0) {data in
if data.first as? String ?? "passed" == SocketAckStatus.noAck {
// Handle ack timeout
}
socket.emit("update", ["amount": cur + 2.50])
}
ack.with("Got your currentAmount", "dude")
}
socket.connect()
Features
- Supports Socket.IO server 2.0+/3.0+/4.0+ (see the compatibility table)
- Supports Binary
- Supports Polling and WebSockets
- Supports TLS/SSL
FAQS
Checkout the FAQs for commonly asked questions.
Checkout the 12to13 guide for migrating to v13+ from v12 below.
Checkout the 15to16 guide for migrating to v16+ from v15.
Installation
Requires Swift 4/5 and Xcode 10.x
Swift Package Manager
Add the project as a dependency to your Package.swift:
// swift-tools-version:4.2
import PackageDescription
let package = Package(
name: "socket.io-test",
products: [
.executable(name: "socket.io-test", targets: ["YourTargetName"])
],
dependencies: [
.package(url: "https://github.com/socketio/socket.io-client-swift", .upToNextMinor(from: "16.1.1"))
],
targets: [
.target(name: "YourTargetName", dependencies: ["SocketIO"], path: "./Path/To/Your/Sources")
]
)
Then import import SocketIO.
Carthage
Add this line to your Cartfile:
github "socketio/socket.io-client-swift" ~> 16.1.1
Run carthage update --platform ios,macosx.
Add the Starscream and SocketIO frameworks to your projects and follow the usual Carthage process.
CocoaPods 1.0.0 or later
Create Podfile and add pod 'Socket.IO-Client-Swift':
use_frameworks!
target 'YourApp' do
pod 'Socket.IO-Client-Swift', '~> 16.1.1'
end
Install pods:
$ pod install
Import the module:
Swift:
import SocketIO
Objective-C:
@import SocketIO;
Docs
Detailed Example
A more detailed example can be found here
An example using the Swift Package Manager can be found here
License
MIT
Explore related projects
codecrafters-io/build-your-own-x
Master programming by recreating your favorite technologies from scratch.
560,444 starspublic-apis/public-apis
A collective list of free APIs
496,762 starsmorluto/rea
Reverse engineer anything with agents, from app behavior down to native binaries.
438,069 starsopenclaw/openclaw
The AI that really does things. Any OS. Any Platform. The lobster way. 🦞
394,072 stars