Skip to content

PubNubDevelopers/python-socket-demo

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code
This branch is 2 commits ahead of ajb413:master.

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 
 
 

Sockets with Python

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

Running the Code (Python sockets)

  • Install Python
  • Clone this repo to your machine
  • python3 server.py
  • python3 client.py (in a separate terminal)

Screenshot

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.py
  • python3 pn_client_2.py (in a separate terminal)

Screenshot

To run this project yourself you can also use your own PubNub keys

Get Your PubNub Keys

PubNub Signup
  1. 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.

  2. Sign in to your PubNub Dashboard.

  3. Click Apps, then Create New App.

  4. Give your app a name, and click Create.

  5. Click your new app to open its settings, then click its keyset.

About

Socket programming demo with native Python and also PubNub.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Python 100.0%