Skip to main content

No project description provided

Project description

Virgodev Websocket Support

provides a uniform system for sending and receiving websocket messages

specs

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

Get Started

  1. Install virgodev_websocket_support

    pip install virgodev_websocket_support
    
  2. Add INSTALLED_APPS setting

    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",
        ...
    )
    
  3. Add ASGI_APPLICATION setting

    ASGI_APPLICATION = 'virgodev_websocket_support.asgi.application'
    

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

    from virgodev_websocket_support.asgi import application as app
    application = app
    
  4. Add CHANNEL_LAYERS setting

    assign the host to the same redis instance as your cache

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

Production

install and use uvicorn

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

virgodev_websocket_support-0.1.0.tar.gz (3.3 kB view hashes)

Uploaded Source

Built Distribution

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