BonjourDevAPIFinder lets you find your local development API servers automatically and choose it instead of the production API in run-time.
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
Example
Pod
Server Example
.gitignore
.travis.yml
BonjourDevAPIFinder.podspec
LICENSE
README.md

README.md

BonjourDevAPIFinder

Version License Platform

Demo

Switch to local network development server, discovered by Bonjour

Production to Development

Switch back to using the original API address

Development to Production

Installation

BonjourDevAPIFinder is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod "BonjourDevAPIFinder"

Usage

To run the example project, clone the repo, and run pod install from the Example directory first.

Enabling Tweaks

BonjourDevAPIFinder uses Tweaks.

You need to make sure Tweaks have a way to be opened (see Tweaks docs).

Adding APIs

Anywhere in your project, before using an api address execute:

[BonjourDevAPIFinder.sharedInstance addApiService:@"API server"
                                       identifier:@"example"];

identifier is the Bonjour advertised name for your service.

To retrieve currently chosen API address use:

[BonjourDevAPIFinder.sharedInstance apiAddressForIdentifier:@"example"
                                          defaultAPIAddress:@"api.example.com"];

That's it!

Tip: you can add more than just one address.

Enabling the server to advertise it's existence

Node.js®

var mdns = require("mdns");
var ad = mdns.createAdvertisement(mdns.tcp(advertisedName), port);
ad.start();

Sample Bonjour-enabled node server project attached in the Server Example folder.

Author

Tomek Kopczuk, tkopczuk@gmail.com

Swing Development

License

BonjourDevAPIFinder is available under the MIT license. See the LICENSE file for more info.