Data API
Motivation
The Data API is a bidirectional streaming interface based on WebSockets and designed for message exchange between the Network Server (NS) and the Application Server (AS) in real-time mode. All LoRaWAN specific operations like OTAA activation are also perfomed using this interface.
The Data API is designed as a real-time interface and does not provide any persistent message storage, device state storage and so on. In other words, it is a pure streaming interface between the AS and the NS.
The Data API is WebSocket based, which allows for developing serverless applications and is widely used in different programming languages.
Endpoint URLs
Everynet is operating in private networks and in different regions, including general EU and US regions. Each region uses it's own endpoint URL.
Custom regions and private networks can get endpoint URLs from Everynet support.
wss://ns.eu.everynet.io/api/v1.0/data - European region
wss://ns.us.everynet.io/api/v1.0/data - United States region
Server locations
LoRaWAN is a synchronous and real-time communication protocol. It means that the overall time of message processing is limited by a default value of one second. It includes all ping times, processing in the NS and the AS and so on. Unfortunately, downlink buffering on the NS side opens a huge security flaw in the protocol and this is the reason why Everynet is not buffering downlink messages. This leads to a situation when the ping time between the AS and the NS becomes critical. Please make sure that your AS is located in the same region as the NS.
Features
The Data API interface provides the following features:
- Continuous bidirectional connection for real-time message receipt and sending to avoid constant NS polling for new messages
- Message reception in JSON format. All LoRaWAN compliant versions are supported: confirmed/unconfirmed, uplinks, join requests, MAC-commands. All metadata could be provided as well: RF parameters, duplicates and so on...
- Downlink message transmission including MAC-commands is performed in an optimal way. The following parameters are optimized: network downlink capacity, best RF channel loss, best chances to reach gateway in time (ping time).
- Receiving of service/debug messages from the NS: like MIC errors or incorrect counter handling.
- Server-based message filtering: by device identifier, gateway, device tag, application, etc.
- Backward compatibility is achieved using a message versioning system.
Getting started
- Install a WebSocket client, for example
wscat
:npm install -g wscat
- Generate Data API key in NS GUI. We got this key:
9ec85978f3fa1ab6f953406269f69a95
Use this URL to connect to Data API:
wss://ns.us.everynet.io/api/v1.0/data?access_token=9ec85978f3fa1ab6f953406269f69a95
Using
wscat
you can connect to the Data API stream:wscat -c "wss://ns.eu.everynet.io/api/v1.0/data?access_token=9ec85978f3fa1ab6f953406269f69a95"
PROFIT!!!111