-
-
Save ToeJamson/7305907 to your computer and use it in GitHub Desktop.
PubNub & Rasberry Pi: Up and Running
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| git clone https://github.com/pubnub/c.git |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| sudo make (to make the library) | |
| sudo make install (to install it) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| cd examples/sync-demo (from the Git directory of your PubNub folder) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| json_object_object_add(msg, "str", json_object_new_string("\"Hello, AT&T Hackers!\" she said.")); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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