forked fromsocketio/socket.io-client-swift
- Notifications
You must be signed in to change notification settings - Fork0
License
NotificationsYou must be signed in to change notification settings
Mu-L/socket.io-client-swift
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
Socket.IO-client for iOS/OS X.
import SocketIOletmanager=SocketManager(socketURL:URL(string:"http://localhost:8080")!, config:[.log(true),.compress])letsocket= manager.defaultSocketsocket.on(clientEvent:.connect){data, ackinprint("socket connected")}socket.on("currentAmount"){data, ackinguardlet cur=data[0]as?Doubleelse{return} socket.emitWithAck("canUpdate", cur).timingOut(after:0){datainif data.firstas?String??"passed"==SocketAckStatus.noAck{ // Handle ack timeout} socket.emit("update",["amount": cur+2.50])} ack.with("Got your currentAmount","dude")}socket.connect()
- Supports Socket.IO server 2.0+/3.0+/4.0+ (see thecompatibility table)
- Supports Binary
- Supports Polling and WebSockets
- Supports TLS/SSL
Checkout theFAQs for commonly asked questions.
Checkout the12to13 guide for migrating to v13+ from v12 below.
Checkout the15to16 guide for migrating to v16+ from v15.
Requires Swift 4/5 and Xcode 10.x
Add the project as a dependency to your Package.swift:
// swift-tools-version:4.2import PackageDescriptionletpackage=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 importimport SocketIO.
Add this line to yourCartfile:
github "socketio/socket.io-client-swift" ~> 16.1.1Runcarthage update --platform ios,macosx.
Add theStarscream andSocketIO frameworks to your projects and follow the usual Carthage process.
CreatePodfile and addpod 'Socket.IO-Client-Swift':
use_frameworks!target'YourApp'dopod'Socket.IO-Client-Swift','~> 16.1.1'end
Install pods:
$ pod installImport the module:
Swift:
import SocketIOObjective-C:
@import SocketIO;
A more detailed example can be foundhere
An example using the Swift Package Manager can be foundhere
MIT
About
No description, website, or topics provided.
Resources
License
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Packages0
No packages published
Languages
- Swift99.3%
- Other0.7%