2. Usecases for pubnub
• IoT Secure Messaging
• IoT Device Control
• Message Push Notification
• Home Automation Signalling
• Check this for more details
https://stackoverflow.com/questions/20843632/what-is-advantage-
and-disadvantage-of-using-pubnub-over-amazon-simple-notificati
by ANSHU PANDEY | anshuspandey@gmail.com
3. Navigate to pubnub.com>> signup for an
account or login with google
by ANSHU PANDEY | anshuspandey@gmail.com
4. Click on Create NEW APP+
by ANSHU PANDEY | anshuspandey@gmail.com
6. After Creating app, scroll down to dashboard
by ANSHU PANDEY | anshuspandey@gmail.com
7. Click on your app, you just created, you might see a default keyset,
which can be used to connect to PubNub and you can also create you
own keyset.
by ANSHU PANDEY | anshuspandey@gmail.com
8. Click on New keyset to create a keyset
by ANSHU PANDEY | anshuspandey@gmail.com
9. You should be able to get three keys which can be used to connect pubnub
Allow pubnub Blocks as shown in below snapshot
by ANSHU PANDEY | anshuspandey@gmail.com
10. Navigate to Blocks option from Left Menu & create a block
by ANSHU PANDEY | anshuspandey@gmail.com
11. Click on create to create event handlers
by ANSHU PANDEY | anshuspandey@gmail.com
12. Name you handler, select after presence from second option, provide
topic in third option and remember the topic
by ANSHU PANDEY | anshuspandey@gmail.com
13. The block is currently stopped, click on start block to start the block
by ANSHU PANDEY | anshuspandey@gmail.com
14. Once the block is running, now you are all set
to communicate via pubnub
by ANSHU PANDEY | anshuspandey@gmail.com
15. Navigate back to keyinfo to get keys
by ANSHU PANDEY | anshuspandey@gmail.com
16. Install python package for pubnub
pip install pubnub
by ANSHU PANDEY | anshuspandey@gmail.com
17. Python code for Configuring PubNub
from pubnub.pnconfiguration import PNConfiguration
from pubnub.pubnub import PubNub, SubscribeListener
from pubnub.enums import PNStatusCategory
pnconfig = PNConfiguration()
pnconfig.publish_key = "pub-c-097ac4e7-23cf-45ee-980f-1775137fdf4e"
pnconfig.subscribe_key = "sub-c-a3cd0700-2bcd-11e7-97de-0619f8945a4f"
pnconfig.secret_key="sec-c-NzJhOGJlZmItNzQ2OC00MmM2LTg3ZjAtNWUxOWE2MjY4NTgx"
pnconfig.uuid="test"
pubnub = PubNub(pnconfig)
by ANSHU PANDEY | anshuspandey@gmail.com
18. Connecting to broker
my_listener = SubscribeListener()
pubnub.add_listener(my_listener)
pubnub.subscribe().channels('mytopic/new').execute()
my_listener.wait_for_connect()
print('connected')
by ANSHU PANDEY | anshuspandey@gmail.com
24. I am Happy to see you on this slide,
Now its your turn to do something exciting with this.
With more Expectation
Anshu Pandey
https://www.linkedin.com/in/anshupandey/
by ANSHU PANDEY | anshuspandey@gmail.com