Skip to main content

FastAPI microservice for chatting

Project description

Usage

  1. Set env variables for chat service
  2. Run python run.py on your server. Chat will be available on endpoint ws://host:port/chat

As soon as you start server there will be connection to redis. Using chat's endpoint user subscribes to queue, receiving data from it. Queue's message must be like: {"sender_id": 1, "reciever_ids": [2, 3, 4]}, "message": {"id": 111}}

  • sender_id - required (all messages have sender)
  • reciever_ids - non-required, can be empty list or this field can even not exist
  • message - non-required, object that will be sent to users

Env variables

*default in ()

  • CHAT_HOST - host for running uvicorn application (0.0.0.0)
  • CHAT_PORT - post for running uvicorn application (8088)
  • CHAT_WORKERS - number of workers for uvicorn application (1)
  • CHAT_BROKER_HOST - host for redis to subscribe to the queue (0.0.0.0)
  • CHAT_BROKER_PORT - port for redis to subscribe to the queue (6300)
  • CHAT_BROKER_DB - db for redis to subscribe to the queue (2)
  • CHAT_CHANNEL_NAME - queue's name to subscribe to (chat)
  • CHAT_DJANGO_BASE_URL - base url of django's application (http://localhost:4114/)
  • CHAT_DJANGO_GET_USER_URL - django's endpoint to get current user's information (api/v1/me)
  • CHAT_DJANGO_TOKEN_TYPE - jwt token's start (Bearer)
  • CHAT_DJANGO_USER_RESPONSE_ID_FIELD - field for getting user's id after request to CHAT_DJANGO_GET_USER_URL

written using python 3.8.2

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

fastapi-chat-sdk-0.0.4.tar.gz (4.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

fastapi_chat_sdk-0.0.4-py3-none-any.whl (6.3 kB view details)

Uploaded Python 3

File details

Details for the file fastapi-chat-sdk-0.0.4.tar.gz.

File metadata

  • Download URL: fastapi-chat-sdk-0.0.4.tar.gz
  • Upload date:
  • Size: 4.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.6.0 importlib_metadata/4.8.2 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.11

File hashes

Hashes for fastapi-chat-sdk-0.0.4.tar.gz
Algorithm Hash digest
SHA256 683a74b33431bc0a2f9ae4f4a8842840e1d6198f25c16971941209b115221dab
MD5 3015da593a01418db7be21d17c1d2086
BLAKE2b-256 0c8c0362ef8cf7b847792ffdfee0fb2ad918ba64b431d548114def26a78fcef2

See more details on using hashes here.

File details

Details for the file fastapi_chat_sdk-0.0.4-py3-none-any.whl.

File metadata

  • Download URL: fastapi_chat_sdk-0.0.4-py3-none-any.whl
  • Upload date:
  • Size: 6.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.6.0 importlib_metadata/4.8.2 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.11

File hashes

Hashes for fastapi_chat_sdk-0.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 1900d0f3b24630fbf8a5943d80bcb205891780b03f5a27ade1b4b25cf83ce4cf
MD5 692f1b5d6b0fb38b359eb5860242d946
BLAKE2b-256 fbc9d8a059df7bdb8325d2501d83e312e1e0df90e14b0aec34fe85a8de63cd4c

See more details on using hashes here.

Supported by

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