Switch to local network development server, discovered by Bonjour
Switch back to using the original API address
BonjourDevAPIFinder is available through CocoaPods. To install it, simply add the following line to your Podfile:
To run the example project, clone the repo, and run
pod install from the Example directory first.
BonjourDevAPIFinder uses Tweaks.
You need to make sure Tweaks have a way to be opened (see Tweaks docs).
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"];
Tip: you can add more than just one address.
Enabling the server to advertise it's existence
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.
Tomek Kopczuk, email@example.com
BonjourDevAPIFinder is available under the MIT license. See the LICENSE file for more info.