Django 5.0: Elevating Experiences with Server-Sent Events – A Journey from Polling to Real-Time Vibes
06-05, 12:05–12:35 (Europe/Madrid), Auditorium

Join me in a detailed exploration as we navigate the complexities of transitioning from traditional polling to real-time functionality using Django SSE in version 5.0. This presentation aims to elucidate the seamless integration of real-time features, maintaining the structural integrity of applications without the need for additional libraries. Importantly, we will not be utilizing Django Channels; instead, we'll focus on leveraging the inherent features of async Django.

Our focal point will be the utilization of Redis as the singular dependency, showcasing the inherent capabilities of Django SSE in version 5.0. Delving into the realm of real-time notifications, the session will encompass a spectrum of approaches – from comprehensive payload delivery to streamlined references. This will be achieved without the need for extensive code rewriting.


Embarking on our exploration, we'll first examine the traditional polling system, unraveling its structure and limitations. Moving forward, we'll delve into the intricacies of structuring an asynchronous Django application that seamlessly complements its synchronous counterpart. Our journey encompasses a concise overview of Server-Sent Events (SSE) and their implementation within the Django framework.

Engaging in discussions, we'll tackle authentication and strategies for handling client disconnections, ensuring a comprehensive understanding of real-time communication in the Django ecosystem.

The session emphasizes a server-side approach, utilizing elementary JavaScript and htmx to augment real-time interactivity. Our aim is to showcase how you can offer real-time solutions without the need to rewrite your applications, leveraging the existing work you've already invested in your apps. Additionally, we'll explore Django Channels, appreciating some of the concepts implemented there to avoid reinventing the wheel and to import relevant ideas.

Furthermore, we'll discuss deployment options and how to seamlessly pair them with a synchronous app.

Moreover, the concepts discussed can be easily adapted to other frameworks, extending the session's applicability and insights beyond the Django ecosystem.

Additionally, we'll delve into load testing for our application, covering the how-to, key parameters, potential pitfalls, and the assumptions guiding our process.

As a bonus, witness a real-time Mastodon firehose-based system demonstration, adding an exciting layer to our exploration.

Video: https://youtu.be/g3AzY9sVg-w


Topics

Async, Deployment, htmx, Rest APIs

Audience Level

Intermediate

A lifelong software tinkerer and seasoned engineer who typically responds with "it depends" to complex challenges. Striving to master the elusive skill of estimation, with a history of learning through failures and implementing recursive loops of backups. A perpetual student, particularly fascinated by the history of software and the complexities of human migration.