hello i have just been assigned today a task of setting up UDP communication/intergration into our back end. The devices are sending data via UDP nbiot and are expecting to recieve a response as confirmation before sending more packets with the data. the decoding is the easy part. I understand that UDP is not the easiest to get connected with Django. I have read quite a bit of the documentation and am struggling to come up with a viable solution that allows for seamless intergration. I understand i could do a custom Socket set it up with a constant celery task and use nginx port routing to get the intended effect but i was wondering if there is a way i can use channels or a similar package to allow for this communication better than the sockets method. Any help would be most appriecated
Absolutely.
A full UDP listener in Python is less than 20 lines of real code. Writing the packets received to a Channels layer is also easy.
Writing this connector between your UDP source and a Django Channels consumer should be less than 50 lines.
See these threads for some ideas:
- my first websocket
- Using background tasks in Django, but how exactly?
- Django iot data streaming into app
- How to integrate GPIO input into django?
If you still have questions after, we’ll still be here.