Skip to content

Instantly share code, notes, and snippets.

@ToeJamson
Last active December 27, 2015 09:39
Show Gist options
  • Select an option

  • Save ToeJamson/7305907 to your computer and use it in GitHub Desktop.

Select an option

Save ToeJamson/7305907 to your computer and use it in GitHub Desktop.
PubNub & Rasberry Pi: Up and Running
git clone https://github.com/pubnub/c.git
sudo apt-get update (just in case you are out of date)
sudo apt-get install libevent-dev libjson0-dev libcurl4-openssl-dev libssl-dev
sudo make (to make the library)
sudo make install (to install it)
cd examples/sync-demo (from the Git directory of your PubNub folder)
struct pubnub_sync *sync = pubnub_sync_init();
struct pubnub *p = pubnub_init(
/* publish_key */ "demo",
/* subscribe_key */ "demo",
/* pubnub_callbacks */ &pubnub_sync_callbacks,
/* pubnub_callbacks data */ sync);
json_object *msg;
json_object_object_add(msg, "str", json_object_new_string("\"Hello, AT&T Hackers!\" she said."));
pubnub subscribe ok, no news
pubnub subscribe [my_channel]: {"num":42, "str": "\\"Hello, AT&T Hackers!\" she said.}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment