Device Communication

Operating principles

  • Devices are clients and the device is always the initiator of any request
  • Your application receives an HTTP POST request and can optionally respond with a message to the device
  • Any Blecon App can relay messages from any Blecon Device
  • The communication is secure between the device and the Blecon service - the Blecon App cannot read any data
  • There are two types of communication - Device Requests and Device Spotted notifications

Device Requests

With Device Requests, Blecon Devices communicate with your application over HTTP using a simple request/response model.
The Blecon Communication Model
Why request/response?
A request-based method is the standard way for a client to communicate with a server, and it's a natural fit for Blecon. Here's why:
  • A request is well suited for a client which is intermittently connected or intermittently active, like a Blecon Device
  • The device making the request immediately knows if it has succeeded and success means the data is received by the application
  • An HTTP request is easy to handle in any web application, it works on any platform, and is well suited to serverless applications
  • No queues or state in the system means device communication is simple and predictable
The kinds of requests devices make
The functionality of a Blecon device request is determined by the device manufacturer and designer. They are responsible for documenting the requests that the device may make, and what response (if any) the application can return.
For example, a temperature sensor would simply report its reading, and no response is needed other than the acknowledgement. However, a digital display would make a configuration request to ask what it should display on the screen, and the response should be some form of an image.
When or how often requests are made
The frequency of requests made from devices is device-dependent. Some devices will make a configuration request to set the request rate of say a sensor.
Devices must make a tradeoff between power usage and resolution of data, and this is application-specific.
In summary - when the device is in range of a Blecon Hotspot, the device will be able to make a request if it needs to.
How requests are delivered to your application
Blecon takes care of translating the device Bluetooth communication to an HTTP request to your application as well as the response.
Your application will receive a request at a Handler URL that you specify containing the request from your device in JSON form. Your application should then respond with JSON also. The response can be effectively empty or depending on the request type you can respond with your data.
If for any reason your application does not respond with an HTTP success code to the request, the device will receive an error response and will try again later.
Read more about Request Handlers in the Cloud Reference section.