Asynchronous TCP Publishing on a Single TCP Payload
If you’ve checked out the PubNub Developer Community before, you may have dove into the Tips, Tricks, and How-To’s section, where our developer community share tutorials, docs, and experiences developing their real-time applications using the many PubNub APIs. We love when our broad community of programming experts share their tips and tricks, and sometimes we even share a couple of our own.
In the video below, our founder and CTO Stephen Blum does just that. In this tips and tricks session, he covers three major topics:
- Message Streaming
- Simultaneous TCP Publishing
- Mobile Gateways for APNs, GCM, and Windows
The video includes live coding, so open up your terminal and follow along!
In this part, we show you a couple cool tricks for both message streaming and data pipelining, all in a terminal window. This enables you to publish messages asynchronously without waiting for responses or feedback from a server. These are essentially large streams of data.
At 1:18, Stephen demonstrates this functionality and simultaneous TCP publishing. This enables you to asynchronously send multiple messages through a single TCP payload. With one MTU, you can bundle multiple messages, chunk them together, and send one TCP package via PubNub. The code and a walkthrough for keeping a TCP socket connection open is available here, and in the video below:
You may be used to /subscribe, our standard high-availability endpoint. Streaming is a less reliable stream of data where the client itself that’s doing the subscription doesn’t have to communicate back to us. This means less log processing, but you can stream more data. (We don’t recommend this for anything outside the firewall, like mobile, but if you’re testing, it’s completely okay.
GCM, APNs, and Windows Push Notifications
Lastly, Stephen gives a brief demonstration of cross-platform push notifications, and where PubNub fits. If you need more information on mobile push notifications, we have lots of tutorials and demos listed below: