I’m not entirely certain this is relevant to your project, but just in case I’ll mention it:
UDP behaves a little differently than you might expect on the Electron because of the way mobile carriers run their networks. In particular, your Electron does not have its own unique IP address assigned to it. The IP address is shared with many other mobile users, and port mapping is used, similar to how a home network shares an IP address. This isn’t specific to the Electron; it applies to your phone as well.
Because of this, even though you can query your public IP address, you cannot make connections out of the blue to a TCPServer or UDP listener running on an Electron, because the mobile carrier has not set up a port mapping for it. There’s no way around that.
If you first send an outgoing UDP request, however, it is possible to receive a UDP response back for a short period of time. This allows most UDP protocols like DNS to work properly. One important thing if you’re writing your own server: Make sure you respond to the port the request came from, not the port you are listening on on the Electron. Because of the port mapping they won’t be the same. The amount of time the mapping is kept active varies by carrier, about 23 minutes for a Particle SIM to 30 seconds for some carriers.