Free up to 1MM monthly messages. No credit card required.
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:
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.
Our TCP connection policy here at PubNub is infinite As soon as you open a connection and send a valid payload to us, we recognize that and let you know with a response, now your socket is open forever. As long as your IP address is the same, and you don’t have any dynamic router changes in the middle, your connection remains open.
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.
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:
Take a look at the top trends that are the most effective in attracting customers and reducing churn, and how you can incorporate...
Comparing the major game engines: Unity vs Unreal Engine vs Corona SDK vs GameMaker Studio, including the benefits and cons of...
Sockets (aka socket programming) enable programs to send and receive data, bi-directionally, at any given moment. This tutorial...