-
Notifications
You must be signed in to change notification settings - Fork 13
Description
I think having a UDP based notifier could be a great addition for some projects that interface with IoT devices. What do y'all think?
Idea background
While working on a simple IoT project I found out some of my house lights communicated via UDP, which gave me the silly idea of having those devices react (i.e turn red) when an exception was encountered.
Phoenix based apps that interface with IoT devices could make a lot of use of a notifier like this, provided their connected devices already handle UDP messages.
How could this be implemented?
We could spin up a GenServer that creates a socket using Erlang's :gen_udp (doc) and use that socket to send events to other connected devices (which can be listed by IP and port).
Alternatively, we could open and close a socket every time an exception occurs, in which case we wouldn't need a GenServer alive - This is just a thought as I don't really know what the best approach for UDP sockets is.
Final notes
This could very well be a separate package, as most Phoenix apps are not IoT related (I would assume). Also, we could add other protocols to the mix to interface with even more IoT devices (TCP, local WIfi, etc)