Skip to content

Latest commit

 

History

History
72 lines (39 loc) · 2.24 KB

File metadata and controls

72 lines (39 loc) · 2.24 KB

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.