NachoSoto eb9de532f1 Fixed build phases order in target
See [Xcode 10's known issues](https://developer.apple.com/documentation/xcode-release-notes/build-system-release-notes-for-xcode-10) in the release notes:

> Targets with Copy Headers build phases ordered after Compile Sources build phases may fail to build and emit a diagnostic regarding build cycles. (39880168)
>*Workaround*: Arrange any Copy Headers build phases before Compile Sources build phases.

This has been an issue for nearly 4 years, and now with Xcode 13.3 it leads to `XCBBuildService` to crash consistently.
2022-04-18 20:16:09 +02:00
2021-02-01 09:27:44 -05:00
2021-06-17 11:38:43 -04:00
2021-01-27 13:22:14 -05:00
2021-07-10 11:32:24 +02:00
2017-05-06 14:41:50 -04:00
2020-11-07 15:13:52 -05:00
2020-11-07 15:13:52 -05:00
2015-03-12 19:59:49 +09:00
2021-07-10 11:32:24 +02:00

Build Status

Socket.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" == SocketAckValue.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: "15.0.0"))
    ],
    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" ~> 15.2.0

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', '~> 15.2.0'
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

Description
No description provided
Readme Multiple Licenses 4.2 MiB
Languages
Swift 99.3%
Ruby 0.5%
Objective-C 0.2%