Recommandations for device-to-device REST API

Hello,

We currently have a Windows PC that hosts an REST API.

We would like our iOS device to send requests to that API, while not being on the same immediate WiFi Network.

We use another piece of hardware that provides us with an SDK, and they require Bonjour services, so I suppose it's a way to do it. In order to have it work, we need to connect to that device thru Bluetooth.

What would be your recommendation?

If both ends of this communication were running on Apple devices there would be an easy way forward: Apple devices support an Apple peer-to-peer Wi-Fi protocol, which allows two nearby devices to communicate without being on the same infrastructure Wi-Fi. However, this protocol is not documented for third-party use, and thus not available on other platforms, and that really limits your options.

If is possible to communicate between arbitrary devices using Bluetooth LE. On Apple devices you do this using the Core Bluetooth framework. However, there’s no connection between Core Bluetooth and the networking stack proper. You can’t, for example, issue a request using the standard HTTP[S] API, NSURLSession, and have it run over Core Bluetooth.

Probably your best option here is to build a bridge between this REST API and Bluetooth LE on the Windows side. Then, on the iOS side, you’d use Core Bluetooth to issue requests to the Bluetooth LE side of the bridge.

One word of caution: Bluetooth LE and HTTP[S] have very different performance models, so it would be best not to create a one-to-one mapping between the two. Rather, have your bridge expose just the functionality you need from the iOS side, and do that in a way that’s optimised for Bluetooth LE.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

Recommandations for device-to-device REST API
 
 
Q