Best Practices for Push Notifications to gpy
Just getting started with the pycom platform, and I've quite enjoyed it so far. I'm deploying a small network of gpy boards on the Verizon network and will need the boards to send and receive real-time updates from the web. The key considerations are:
a) the speed of the updates (preferably < 1 second), and
b) the reliability of the updates.
I'm not too worried about sending updates from the board (there are many good solutions; we'll probably use a Restful API), but I'm a bit concerned about receiving updates. Is there a best practice for this kind of situation?
The three ideas that came to mind:
- Send text messages to the board. This works well on the gpy end, but can introduce lag on the server end (e.g. sending emails to firstname.lastname@example.org can take up to a minute). I could physically attach a pycom to the server to send text messages and improve the server end, but that seems silly. Edit: I also just noticed that Verizon has a 100 SMS limit on all their Cat M1 plans, so this seems like a bad approach.
- Run a very small server on the pycom (I assume this is possible) and perform calls to the device IP address directly. I've done something similar in the past, but I'm not sure how often Verizon cycles IP addresses, so it could prove unreliable.
- Have the pycom use websockets or a long-running http call to get realtime updates. This also seems plausible, but I haven't tried it.
Any experience with these approaches/other suggestions? Thanks!
Thanks! Appreciate the recommendation.
@Patton-Doyle if you don’t have battery life constraints I would go for websockets, or any form of device-initiated TCP connnection. Haven’t tried it on a Pycom device but it should be pretty straightforward.
If you do it yourself rather than using an existing library don’t forget keep alive pings and connection re-establishment, of course.