This repository contains example code for exchanging data between a client and server over Python sockets:
client.py
server.py
Code examples are also given for exchanging data between two Python clients directly using PubNub:
pn_client_1.py
pn_client_2.py
- Install Python
- Clone this repo to your machine
python3 server.py
python3 client.py
(in a separate terminal)
- Install the PubNub package with pip (lastest as of Feb 2023):
pip3 install 'pubnub>=7.1.0'
python3 pn_client_1.py
python3 pn_client_2.py
(in a separate terminal)
To run this project yourself you can also use your own PubNub keys
-
You’ll first need to sign up for a PubNub account. Once you sign up, you can get your unique PubNub keys from the PubNub Developer Portal.
-
Sign in to your PubNub Dashboard.
-
Click Apps, then Create New App.
-
Give your app a name, and click Create.
-
Click your new app to open its settings, then click its keyset.