Skip to main content

A chatserver written in python

Project description

Chat Server

A simple chat server written in python.

Features

The features of chatserver include:

  • Optional TLS
  • User accounts
  • Chat Rooms

TLS Certificates

Setup is only currently required if you want to use tls. To do this you need to generate a crt and key file.

mkdir certs
cd certs
openssl req -newkey rsa:2048 -nodes -keyout chatserv.key -x509 -days 365 -out chatserv.crt

Running The Server

Pip

You can install chatserver using pip.

pip install --upgrade chatserver
chatserver

Build Locally

Make sure poetry is installed and up to date.

pip install --upgrade poetry

Install all the dependencies

poetry install

You can now run the project from outside poetry's virtual env

poetry run chatserver

Or from within it

chatserver

If you want to use TLS you need to set environment variables>

  • CERT_FILE
  • KEY_FILE

With Docker

You can either build locally or use the image from the registry

# Build locally
docker build -t chatserver .
docker run --name chatserver_name -p 7878:7878 chatserver
# Using the image from the registry
docker build -t chatserver .
docker run --name chatserver_name -p 7878:7878 registry.gitlab.com/mokytis/python-chatserver:latest

To use tls you will need to mount a direcory containg the crt and key files and set enviornment variables.

Example:

docker run -i -t -d \
    -p 7878:7878 \
    -v /path/to/certs/directory:/certs \
    -e CERT_FILE='/certs/chatserv.crt' \
    -e KEY_FILE='/certs/chatserv.key' \
    --name chatserver
    chatserver

Connecting To The Server

No TLS

If the server is not using tls you can connect to the server using any TCP client.

nc localhost 7878

TLS

If the server is using TLS you can connect using openssl

openssl s_client -connect localhost:7878

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

chatserver-0.1.3.tar.gz (4.8 kB view details)

Uploaded Source

Built Distribution

chatserver-0.1.3-py3-none-any.whl (5.0 kB view details)

Uploaded Python 3

File details

Details for the file chatserver-0.1.3.tar.gz.

File metadata

  • Download URL: chatserver-0.1.3.tar.gz
  • Upload date:
  • Size: 4.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.0.3 CPython/3.8.0 Linux/5.0.0-38-generic

File hashes

Hashes for chatserver-0.1.3.tar.gz
Algorithm Hash digest
SHA256 885051a66da8c35696b57765218cdbe0c771f4e73f460d747e2edf3cc78c0004
MD5 a912be264e3d2872f3dd8df2cdf62b6a
BLAKE2b-256 3e13dd5f2b5cc0d24682fe7763da4760c195b6f4a3606735aa6f2c163cc7fbf2

See more details on using hashes here.

Provenance

File details

Details for the file chatserver-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: chatserver-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 5.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.0.3 CPython/3.8.0 Linux/5.0.0-38-generic

File hashes

Hashes for chatserver-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 876d68f0ddbeb7ac9391ef371facae1243739b74b5006aed9ae040422cb19cf1
MD5 2fefdba45c2f40cc023b89a67ccdccce
BLAKE2b-256 2dcbbef6a400527374bf3c5f7ee5809c3a9b7d50b7ed792e5cd1c17ba0905ad0

See more details on using hashes here.

Provenance

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page