Metadata-Version: 2.1
Name: virgodev-websocket-support
Version: 0.1.0
Summary: 
Author: Your Name
Author-email: you@example.com
Requires-Python: >3.10
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.11
Requires-Dist: channels (>=4.0.0,<5.0.0)
Requires-Dist: channels-redis (>=4.1.0,<5.0.0)
Requires-Dist: django-rest-framework (>=0.1.0,<0.2.0)
Description-Content-Type: text/markdown

# Virgodev Websocket Support

provides a uniform system for sending and receiving websocket messages


## specs

- [ ] documentation for connecting django-channels
- [x] support functions for making django-channels easy
  - [x] signal for when a message is received
  - [x] create a function to send messages to a user
  - [x] create a function to send messages to a group


## Get Started

1. Install virgodev_websocket_support

    ```python
    pip install virgodev_websocket_support
    ```

1. Add INSTALLED_APPS setting

    ```python
    INSTALLED_APPS = (
        "daphne",  # install at the top to convert `runserver` into a websocket client
        "django.contrib.auth",
        "django.contrib.contenttypes",
        "django.contrib.sessions",
        "django.contrib.sites",
        "virgodev_websocket_support",
        ...
    )
    ```

1. Add ASGI_APPLICATION setting

    ```python
    ASGI_APPLICATION = 'virgodev_websocket_support.asgi.application'
    ```

    or use the asgi from your own application's asgi file

    ```python
    from virgodev_websocket_support.asgi import application as app
    application = app
    ```


1. Add CHANNEL_LAYERS setting

    assign the host to the same redis instance as your cache

    ```python
    CHANNEL_LAYERS = {
        "default": {
            "BACKEND": "channels_redis.core.RedisChannelLayer",
            "CONFIG": {
                "hosts": [CACHES["default"]["LOCATION"]],
                "group_expiry": 60 * 10,
            },
        },
    }
    ```

## Production

install and use uvicorn

