PubNub HTTP Pipelining
Sending messages in parallel and in a Single TCP Packet (one Ethernet Frame) is really easy with PubNub HTTP Pipelining! We provide an example below of the Socket level data you send per message. Note that we support the full Pipelining mechanism for HTTP Pipelining. You may send serially on a single socket without waiting for the response and the responses return in order.
Essentially -- To really make this happen with top tier performance you would follow this recipe:
- Open 100 TCP sockets to geo1.pubnub.com (closest data center) with fallbacks next closest data center of geo2.pubnub.com geo3.pubnub.com.
- Send HTTP/1.1 commands round robin -- without waiting for responses you may continue sending commands! -- Pipelining!
- Add socket fail detect or TIMEOUTs as needed for retries.
- Rejoice with awesome cool-guy dance moves.
PubNub Publish Format
GET /publish/PUB_KEY/SUB_KEY/0/CHANNEL/0/PAYLOAD HTTP/1.1\r\n Host: pubsub.pubnub.com\r\n\r\n
Pipeline Publish 3 Messages in 1 TCP Packet
GET /publish/demo/demo/0/chan/0/"ONE" HTTP/1.1\r\n Host: pubsub.pubnub.com\r\n\r\n GET /publish/demo/demo/0/chan/0/"TWO" HTTP/1.1\r\n Host: pubsub.pubnub.com\r\n\r\n GET /publish/demo/demo/0/chan/0/"THREE" HTTP/1.1\r\n Host: pubsub.pubnub.com\r\n\r\n
This following example will show you what publishing three messages in a single TCP Packet may look like. You should test this directly in your Terminal Window via TELNET app.
telnet pubsub.pubnub.com 80 GET /publish/demo/demo/0/my_channel/0/"ONE" HTTP/1.1 Host: pubsub.pubnub.com GET /publish/demo/demo/0/my_channel/0/"TWO" HTTP/1.1 Host: pubsub.pubnub.com GET /publish/demo/demo/0/my_channel/0/"THREE" HTTP/1.1 Host: pubsub.pubnub.com