Sockets with Python
This repository contains example code for exchanging data between a client and server over Python sockets:
client.pyserver.py
Code examples are also given for exchanging data between two Python clients directly using PubNub:
pn_client_1.pypn_client_2.py
Running the Code (Python sockets)
- Install Python
- Clone this repo to your machine
python3 server.pypython3 client.py(in a separate terminal)
Running the Code (PubNub)
- Install the PubNub package with pip (lastest as of Feb 2023):
pip3 install 'pubnub>=7.1.0' python3 pn_client_1.pypython3 pn_client_2.py(in a separate terminal)
To run this project yourself you can also use your own PubNub keys
Get Your 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.

