I would like setting up my own CoAP server in the cloud to receive NB-IoT messages from my SARA N211 devices.
What (open source) CoAP server would you suggest? I suppose sending messages is within the AT command set of the SARA N211 U-Blox?
On the other hand I was also thinking about MQTT-SN (bridging with an MQTT broker). But , since I only can send AT UDP messages, I haven’t a clue how to achieve this? Maybe someone can give me some hints?
To save you some time, an important question is if you need to have multipart paths (eg. the path “rooms/421/light” consists of 3 parts, in CoAP-speak) or multipart queries (the query “?device=sensor&id=1234&key=5678” consists of 3 parts) in your URI. The reason I say this is that I have not been able to make the Sara-N211 separate these according to RFC7252. It will separate the path from the query, but won’t go any further than that.
(If anyone knows how to do this, or if a this becomes possible with a new FW, please reply!!!)
The alternative, implementing a CoAP / MQTT-SN client on top of UDP, can be a challenge. But then again, at least you will have control over the code. And also you will be free to use other modules (most NB-IoT modules I know don’t have commands for pure CoAP, even the newer u-blox R410).
There are libraries both for MQTT-SN and for CoAP (eg. in the post NB IoT Shield in Germany Holger mentioned he has some example files for this. T-Mobile/DT also has quite a bit of software on https://github.com/telekom/LibNbiot ). Needless to say, some adaptations will be necessary and it is not always easy to edit code made by other people.
You can just use the commands for a udp packet and add the relevant CoAP info in front of what you are trying to send (in HEX format) , its not too hard especially if its only a few repeatable instructions. Here is some information on how to construct the Coap packet structure
I use Wia’s CoAP api here. It’s really easy to use and you can just chat to them if you have any problems. You can process the data on their cloud server as well. Perfect for getting started.
Generally, I found other CoAP api’s useful but have a steeper learning curve.