FastAPI microservice for chatting
Project description
Usage
- Set env variables for chat service
- Run
python run.pyon 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 existmessage- 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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file fastapi-chat-0.0.2.tar.gz.
File metadata
- Download URL: fastapi-chat-0.0.2.tar.gz
- Upload date:
- Size: 4.7 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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4ca5e05647426685ff55d0428f5a53cc60777f4b2d310fe651c5cf92fbb4b2db
|
|
| MD5 |
769fa064e309aea18f61a6f3e55d3a2c
|
|
| BLAKE2b-256 |
35ba4a13565c78869da82c775eb545b1724eb5e0f77787ecc1f15ed0f9081dbb
|
File details
Details for the file fastapi_chat-0.0.2-py3-none-any.whl.
File metadata
- Download URL: fastapi_chat-0.0.2-py3-none-any.whl
- Upload date:
- Size: 6.2 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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7c495b4fe69706a4eed3280c241413726cff5d7695b06b9fe6544194d1c94ae8
|
|
| MD5 |
0886bec09cd503d7d2940827f3797d6f
|
|
| BLAKE2b-256 |
17c097aecf0344545f48d91d8276bf6c43438c4000fa021464b330c40fbc3fdc
|