ampq-websockets
Websocket server based on websockets using ampq protocol for messaging
Tested on python 3.9.9
Requirements:
- redis >= 2.9.1
- pika >= 1.2.0
- websockets >= 10.1
Installation:
pip install py-ampq-websockets-server
Usage:
Subscribing to room
Browser -> (subcribing to room) -> py-sockjs -> (assign id and add) -> redis
Sending data to room
- Py Framework -> (get connect by room) -> redis
( Django, Flask and etc. )
- Py Framework -> (put data) -> rabbitmq -> (data) -> py-sockjs -> (send data) -> Browser
Run
python src/ampq_websockets/runserver.py
Optional
Django integration
- Make Command in the project: <any_app>/management/command/websocket_server.py
from django.conf import settings
import ampq_websockets
class Command(BaseCommand):
def handle(self, *args, **options):
logger = logging.getLogger(__name__)
logger.info('start django-websocket-server')
ampq_websockets.start(settings.DJANGO_WEBSOCKET_SERVER)
- Make DJANGO_WEBSOCKET_SERVER in settings.py. Example:
DJANGO_WEBSOCKET_SERVER = {
'RABBIT_SERVER': {
"USER": "guest",
"PASSWORD": "guest",
"SERVER": {
"HOST": "localhost",
"PORT": 5672,
"VHOST": "/"
},
"EXCHANGE_NAME": "sockjs",
"EXCHANGE_TYPE": "direct",
"QUEUE_NAME": "ws01"
},
'REDIS_SERVER': {
"HOST": "localhost",
"PORT": 6379,
"DB": 0,
"PASSWORD": None,
"PREFIX": "sockjs:"
},
'HOST': '0.0.0.0',
'PORT': 8083,
'LOCATION': '/ws',
'SECRET_KEY': 'PLEASE_SET'
}
Metadata
Release files for py-ampq-websocket-server 0.1.7
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| py-ampq-websocket-server-0.1.7.tar.gz | 10.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| py_ampq_websocket_server-0.1.7-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 21.5 kB
Release files / py-ampq-websocket-server-0.1.7.tar.gz
| Download URL | py-ampq-websocket-server-0.1.7.tar.gz |
|---|---|
| Size | 10.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
6956e000778e9f8051ee8207fab77ff7503647ad6d1f01c315bc8581f4830193
|
|
BLAKE2b-256 checksum How to use checksums |
2fd1d7ce53678cc4a9c1aeb013f505baf1ea6f13e558cf8ef3d022837f9cc044
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.7.1 importlib_metadata/4.10.1 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.9
|
Release files / py_ampq_websocket_server-0.1.7-py3-none-any.whl
| Download URL | py_ampq_websocket_server-0.1.7-py3-none-any.whl |
|---|---|
| Size | 11.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d4b6fa6b929f3a989dec4c370511a30c9ba8a65f10214eef54a4b6be9506808f
|
|
BLAKE2b-256 checksum How to use checksums |
38add32332fee2898030abf0e5da56d4e75458b980ff9727a5088a34749ae17b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.7.1 importlib_metadata/4.10.1 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.9
|