PubNub DSN (Data Stream Network) offers low-footprint embedded messaging frameworks for IoT devices with low powered onboard resources available. Protocols like WebSockets, MQTT and PubNub Messaging over HTTP offers the minimum requirements for low-bandwidth and low-powered embedded devices with devices running operating systems like RTOS, Contiki, Arduino and MBed.
Most Common Ethernet Frame Format: We are here to fulfill the need to transmit frames through a DSN to enable fast, reliable IoT Embedded Messaging.
PubNub's POSIX C client SDK is a good baseline starting point where you can follow the directions on PubNub C Library on GitHub to compile the C sources. If you compile the examples/sync-demo example, and strip the debug symbols, you are left with a footprint of 40K for the library (libpubnub), and 10K for the actual POSIX C Sync Demo App.
Sample Size: IoT Embedded Network Messaging Population Footprint - https://vine.co/v/OgvKlJ16Ixw
This can be reduced further! A baseline minimum is available by using standard berkley sockets or a embedded TCP stack. Here is an example of HTTP Streaming over TCP using Telnet Streaming your JSON message payloads over TCP socket.
HTTP Streaming over TCP full Payload Example
GET /stream/demo/bot/0/10000 HTTP/1.1 Host: pubnub
GET /publish/demo/demo/0/chan/0/"YOUR_MESSAGE_HERE" HTTP/1.1 Host: pubnub
libpubnub could be further reduced by substituting certain dependencies, such as libcurl, libjson, etc. But in general libpubnub offers you a small footprint on embedded device.
On Contiki, we run approximately 900 bytes per context. In a normal Pub/Sub world, you'd be running two contexts (one for subscribe, and one for everything else). Just like for the POSIX C client, the user can configure the amount of RAM for message buffers, the defaults being 768 bytes.
IoT Bar Graph: RAM Footprint for IoT Devices in Bytes
On Arduino, the flash memory overhead is 5,586 bytes, while the RAM overhead is 490 bytes.
The PubNub library requires the Ethernet library (and transitively, SPI library); this library has the flash overhead of 8,274 bytes and RAM overhead of 230 bytes.
You can optionally use the
aJson library with PubNub for simpler JSON parsing; though that's not required. The exact overhead is a bit tricky to compute, but approximate numbers are about 10K flash and 0.5K of RAM.
The PubNub library is 20,832 bytes flash, ~200 bytes RAM + 2KB dynamically allocated buffer (tunable, transient).