How does PubNub offer bidirectional communication without opening ports as mentioned in the video?
PubNub starts by initiating a data stream connection to the nearest data center without needing to open ports using
listen(). These are standard Berkley socket methods used for opening ports on the mobile phone, server or embedded device. You don't need to do this with PubNub. Instead PubNub starts with outbound connections only. This is a bonus for firewall considerations because no ports need to be opened. This grants enhanced security when developing your mobile/embedded apps.
Adding more details: The TCP address tuple still requires a Request IP/PORT and Response IP/PORT plus Protocol (the 5-tuple). PubNub uses standard internet ports 80 for plain text and 443 for TLS. We use anycast Geo DNS for IP address resolution to acquire the destination IP Address. The client response IP/PORT is automatically negotiated for your as the developer. That's why we describe connecting to PubNub without needing you to "open ports"; you are never binding and listening on a port.
Thanks Stephen, so it is always connected connection in order to achieve realtime? Would that drain the device battery if I am to run it on an IoT with button cell?
Or maybe there is an option to periodic poll for data? But the down side of this approach would be the latency between polling cycle?
Thank you Richard