Publish and discover services using Bonjour

Overview

Ciao

Platforms License

Swift Package Manager Carthage compatible CocoaPods compatible

Travis

Lib to publish and find services using mDNS

Requirements

  • iOS 8.0+ / Mac OS X 10.10+ / tvOS 9.0+
  • Xcode 9.0+

Installation

CocoaPods

CocoaPods is a dependency manager for Cocoa projects. You can install it with the following command:

$ gem install cocoapods

To integrate Ciao into your Xcode project using CocoaPods, specify it in your Podfile:

source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.0'
use_frameworks!

pod 'Ciao', '~> 2.1.1'

Then, run the following command:

$ pod install

Carthage

Carthage is a decentralized dependency manager that automates the process of adding frameworks to your Cocoa application.

You can install Carthage with Homebrew using the following command:

$ brew update
$ brew install carthage

To integrate Ciao into your Xcode project using Carthage, specify it in your Cartfile:

github "AlTavares/Ciao" ~> 2.1.1

Swift Package Manager

To use Ciao as a Swift Package Manager package just add the following in your Package.swift file.

dependencies: [
    .package(url: "https://github.com/AlTavares/Ciao.git", from: "2.1.1")
]

Usage

Server

let ciaoServer = CiaoServer(type: ServiceType.tcp("ciaoserver"))

ciaoServer.start { (success) in
    print("Server started:", success)
}
ciaoServer.txtRecord = ["someKey": "someValue"]

Browser

let ciaoBrowser = CiaoBrowser()

// get notified when a service is found
browser.serviceFoundHandler = { service in
    print("Service found")
    print(service)
}

// register to automatically resolve a service
browser.serviceResolvedHandler = { service in
    print("Service resolved")
    print(service)
    print(service.hostName)
    print(service.txtRecordDictionary)
}

browser.serviceRemovedHandler = { service in
    print("Service removed")
    print(service)
}

ciaoBrowser.browse(type: type) 

Resolver

Optionally you can also use the resolver to any NetService instance

var resolver = CiaoResolver(service: service)
resolver?.resolve(withTimeout: 0) { (result: Result<NetService, ErrorDictionary>) in
    print(result)
}

Contributing

  1. Fork it!
  2. Create your feature branch: git checkout -b my-new-feature
  3. Commit your changes: git commit -am 'Add some feature'
  4. Push to the branch: git push origin my-new-feature
  5. Submit a pull request :D

License

Ciao is released under the MIT license. See LICENSE for details.

You might also like...
Swift HTTP server using the pre-fork worker model

Curassow Curassow is a Swift Nest HTTP Server. It uses the pre-fork worker model and it's similar to Python's Gunicorn and Ruby's Unicorn. It exposes

WebSocket(RFC-6455) library written using Swift

DNWebSocket Object-Oriented, Swift-style WebSocket Library (RFC 6455) for Swift-compatible Platforms. Tests Installation Requirements Usage Tests Conf

An awesome Swift HTML DSL library using result builders.

SwiftHtml An awesome Swift HTML DSL library using result builders. let doc = Document(.html5) { Html { Head { Meta()

 Postie - The Next-Level HTTP API Client using Combine
Postie - The Next-Level HTTP API Client using Combine

Postie - The Next-Level HTTP API Client using Combine Postie is a pure Swift library for building URLRequests using property wrappers.

macOS VM for Apple Silicon using Virtualization API
macOS VM for Apple Silicon using Virtualization API

MacVM macOS Monterey added support for virtualizing macOS with Apple silicon host. This project provides an example project for the setup. Currently o

Generic Network Layer created using Swift.

Generic-Network-Layer_iOS Generic Network Layer created using URLSession. Networking is an essential element in app development, and you'll need API c

A reactive library for using URLSession

Reactive wrapper for URLSession using Combine. At its core, the library consist of the NetworkServiceClient protocol along with a minimal implementation NetworkService.

Advanced Networking Layer Using Alamofire with Unit Testing

Advanced Networking Layer Using Alamofire with Unit Testing

❌📱 A little swift Internet error status indicator using ReachabilitySwift

EFInternetIndicator Requirements Xcode 8.0+ iOS 8.3+ WARNING : It's not work on simulator. #1 Installation CocoaPods You can use CocoaPods to install

Comments
  • Is there a client/peer limit to Ciao and does is allow users to connect and share data with each other?

    Is there a client/peer limit to Ciao and does is allow users to connect and share data with each other?

    Hello,

    I wanted to use the Multipeer Connectivity framework but there is a limit of 8 peers per session. That isn't ideal for my app. I came across a post on apple developer (photo below) that said it's possible to go beyond that limit using Bonjour and I came across Ciao.

    Using Ciao is it possible for users of the app to connect with one another and to share data?

    How many users does Ciao allow to connect with each other?

    If there is a limit can it be increased?

    Screen Shot 2020-02-22 at 12 50 10 AM

    opened by lsamaria 4
  • Cannot find services

    Cannot find services

    I'm trying to find services using the following code :

    ` func scanCiao(){ let ciaoBrowser = CiaoBrowser()

        ciaoBrowser.browse(type: "_hap._tcp.") { service in
            print(service)
            print(service.txtRecordDictionary)
         print(service.hostName)
        }
    

    ` But all i get in the console is:

    2018-06-27 03:32:19391 [info][CiaoBrowser.swift]:103 netServiceBrowserWillSearch -> "Browser will search" 2018-06-27 03:32:19398 [info][CiaoBrowser.swift]:22 isSearching -> true

    I have lots of services running and I can "see" them with a bonjour browsing app.

    What am I doing wrong ?

    Thanks in advance!

    opened by SwatGuard 1
Owner
Alexandre Mantovani Tavares
Alexandre Mantovani Tavares
This generic SOAP client allows you to access web services using a your iOS app, Mac OS X app and AppleTV app.

This generic SOAP client allows you to access web services using a your iOS app, Mac OS X app and Apple TV app. With this Framework you can create iPh

Prioregroup.com 479 Nov 22, 2022
Easy to use SMJobBless, along with a full Swift implementation of the Authorization Services and Service Management frameworks

Leverage SMJobBless functionality with just one function call: let message = "Example App needs your permission to do thingamajig." let icon = Bundle.

null 20 Dec 23, 2022
Simple iOS app in Swift to show AQI for some cities using websocket using Combine + MVVM

AQI Simple iOS app in Swift to show AQI for some cities using websocket using Combine + MVVM This app follows MVVM This app uses combine framework The

Amey Vikkram Tiwari 2 Nov 6, 2022
NSURLSession network abstraction layer, using Codable and Decodable for response and Encodable for request. ⚙️🚀

SONetworking NSURLSession network abstraction layer, using Codable and Decodable for response and Encodable for request. Project Folder and File Struc

Ahmad AlSofi 4 Jan 28, 2022
Socket framework for Swift using the Swift Package Manager. Works on iOS, macOS, and Linux.

BlueSocket Socket framework for Swift using the Swift Package Manager. Works on iOS, macOS, and Linux. Prerequisites Swift Swift Open Source swift-5.1

Kitura 1.3k Dec 26, 2022
SSL/TLS Add-in for BlueSocket using Secure Transport and OpenSSL

BlueSSLService SSL/TLS Add-in framework for BlueSocket in Swift using the Swift Package Manager. Works on supported Apple platforms (using Secure Tran

Kitura 87 Nov 15, 2022
Plugin and runtime library for using protobuf with Swift

Swift Protobuf Welcome to Swift Protobuf! Apple's Swift programming language is a perfect complement to Google's Protocol Buffer ("protobuf") serializ

Apple 4.1k Jan 6, 2023
Snap Scraper enables users to download media uploaded to Snapchat's Snap Map using a set of latitude and longitude coordinates.

Snap Scraper Description Snap Scraper is an open source intelligence tool which enables users to download media uploaded to Snapchat's Snap Map using

Dr Richard Matthews 58 Dec 12, 2022
iOS Todo Application using RxSwift and ReactorKit

RxTodo RxTodo is an iOS application developed using ReactorKit. This project is for whom having trouble with learning how to build a RxSwift applicati

Suyeol Jeon 1.3k Jan 3, 2023
A slim implementation of a websocket server using Swift and Vapor 4.0.

Swift Websocket Server Example using Vapor 4.0 This project includes a minimum working example for a websocket server written in Swift. To interact wi

Adrian Hupka 5 Sep 22, 2022