Hacking Django Channels for Fun (and Profit)
06-03, 10:45–11:30 (Europe/Paris), Main Room

Django is growing some great async features and Channels has been great for handling websockets connecting from your visitor's browser. But what happens when you need to do more? What if you want to keep long-running connections from Django to other websockets, such as Discord servers? How do you do this and still leverage all the batteries included with Django? We will show an approach that makes this all possible and easy as a developer.


  • Intro and Backstory on Django Channels history — 3%
    • Synchronous vs Async Request Loops
    • WSGI vs ASGI for your Django Application
  • Intro to WebSockets — 3%
    • Demo of them used in the real world web applications
    • How they interact with async event loops
  • Django Channels Core Concepts — 10%
    • Consumers
    • Channel Layers
    • Background Workers
  • Consumers and ASGI Routing Example — 10%
  • Where to Background Workers Fit? — 10%
    • Lightweight Tasks
    • Considerations when reliability is not needed
  • How about reversing the Consumer use case? — 20%
    • Create long-running Background Workers
    • Connect to remote services such as Discord to create Bots
  • Example application integration with Discord — 20%
    • Connect to Discord on start and listen for messages and other events
    • Send our own application messages into Discord
  • Building your own long-running Channel Worker — 20%
    • What to add to your project
    • Define channel background tasks to run at start
  • Next steps for this project — 2%
    • Upstream or create Channels addon to make this functionality more generic
    • Add ability to define one-shot tasks
    • Add ability to define post-job tasks to run on stop
  • Conclusion — 2%

Calvin Hendryx-Parker is the co-founder and CTO of Six Feet Up, a software company that helps organizations build apps faster, innovate with AI, simplify Big Data, and leverage Cloud technology. At Six Feet Up, Calvin establishes the company's technical vision and leads all aspects of the company's technology development. He provides the strategic vision for enhancing the offerings of the company and infrastructure, and works with the team to set company priorities and implement processes that will help improve product and service development. Calvin is the driving force behind LoudSwarm, a high impact virtual event platform that debuted in June 2020.

Calvin is the co-founder of the Python user group IndyPy, the largest tech meetup in Indiana with 1,900+ members. In 2017, he also founded IndyAWS, now the fastest growing cloud meetup in the state with 800+ members. In 2019, he got recognized as an AWS Community Hero by AWS experts.

Outside of work, Calvin spends time tinkering with new devices like the AWS DeepRacer, CircuitPython and Raspberry Pi. Calvin is an avid distance runner and ran the 2014 NYC Marathon to support the Innocence Project. Before the pandemic, he and the family have enjoyed an annual extended trip to France where his wife Gabrielle, the CEO of Six Feet Up, is from. Calvin holds a Bachelor of Science from Purdue University.

Twitter: https://twitter.com/calvinhp
Github: https://github.com/calvinhp
LinkedIn: https://www.linkedin.com/in/calvinhp/

This speaker also appears in: