Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
A Brief History of Channels
Search
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
Andrew Godwin
March 31, 2016
Programming
2.8k
2
Share
A Brief History of Channels
A talk I gave at DjangoCon Europe 2016
Andrew Godwin
March 31, 2016
More Decks by Andrew Godwin
See All by Andrew Godwin
Reconciling Everything
andrewgodwin
1
380
Django Through The Years
andrewgodwin
0
300
Writing Maintainable Software At Scale
andrewgodwin
0
510
A Newcomer's Guide To Airflow's Architecture
andrewgodwin
0
410
Async, Python, and the Future
andrewgodwin
2
730
How To Break Django: With Async
andrewgodwin
1
800
Taking Django's ORM Async
andrewgodwin
0
790
The Long Road To Asynchrony
andrewgodwin
0
750
The Scientist & The Engineer
andrewgodwin
1
830
Other Decks in Programming
See All in Programming
Going Multiplatform with Your Android App (Android Makers 2026)
zsmb
2
440
Claude CodeでETLジョブ実行テストを自動化してみた
yoshikikasama
0
140
Oxlintとeslint-plugin-react-hooks 明日から始められそう?
t6adev
0
280
「話せることがない」を乗り越える 〜日常業務から登壇テーマをつくる思考法〜
shoheimitani
4
840
属人化しないコード品質の作り方_2026.04.07.pdf
muraaano
0
220
(Re)make Regexp in Ruby: Democratizing internals for the JIT
makenowjust
2
500
JAWS-UG横浜 #100 祝・第100回スペシャルAWS は VPC レスの時代へ
maroon1st
0
160
의존성 주입과 모듈화
fornewid
0
150
アーキテクチャモダナイゼーションとは何か
nwiizo
19
5.3k
感情を設計する
ichimichi
5
1.5k
Offline should be the norm: building local-first apps with CRDTs & Kotlin Multiplatform
renaudmathieu
0
220
〜バイブコーディングを超えて〜 チームで実験し続けたAI駆動開発
tigertora7571
0
140
Featured
See All Featured
Dominate Local Search Results - an insider guide to GBP, reviews, and Local SEO
greggifford
PRO
0
150
XXLCSS - How to scale CSS and keep your sanity
sugarenia
250
1.3M
Beyond borders and beyond the search box: How to win the global "messy middle" with AI-driven SEO
davidcarrasco
3
110
Connecting the Dots Between Site Speed, User Experience & Your Business [WebExpo 2025]
tammyeverts
11
890
Organizational Design Perspectives: An Ontology of Organizational Design Elements
kimpetersen
PRO
1
680
Digital Projects Gone Horribly Wrong (And the UX Pros Who Still Save the Day) - Dean Schuster
uxyall
0
1.2k
The B2B funnel & how to create a winning content strategy
katarinadahlin
PRO
1
340
Designing Powerful Visuals for Engaging Learning
tmiket
1
350
The Curious Case for Waylosing
cassininazir
0
310
HU Berlin: Industrial-Strength Natural Language Processing with spaCy and Prodigy
inesmontani
PRO
0
320
So, you think you're a good person
axbom
PRO
2
2k
Lessons Learnt from Crawling 1000+ Websites
charlesmeaden
PRO
1
1.2k
Transcript
Andrew Godwin @andrewgodwin BRIEF HISTORY of CHANNELS A
Andrew Godwin Hi, I'm Django core developer Senior Software Engineer
at Likes networking a little bit too much
Channels
Channels?
WebSocket
HTTP 1 request response Browser Server request response request response
request response
HTTP 2 request response Browser Server request response request 1
response 2 request 2 response 1
WSGI request response Browser Server Django call app return val
WebSockets receive send Browser Server send receive send send
receive send Browser Server send receive send send Django ?
Hard to deadlock Built-in authorisation Scales down Widely deployable Optional
Django is not built for this.
But what if it was?
Instead of requests, we have events
Events of the same type are grouped on a named
channel
HTTP requests HTTP responses WebSocket connecteds WebSocket frames received WebSocket
frames sent WebSocket disconnections
A channel is a: named, first-in-first-out, at-most-once, non-broadcast, network-transparent queue
of messages
http.request Protocol Server Worker Server http.response websocket.connect websocket.send websocket.receive websocket.send
websocket.send
Responses are on single-reader channels (http.response!1A2B3C)
You can send onto channels from anywhere
How do you use it?
View request response callable
Consumer event event callable event event
Every message on a channel runs the consumer function
http.request routes to a view system consumer
def ws_message(message): # Get things from message data = json.loads(message['text'])
# Use ORM like normal MyModel.objects.create( value=data['value'], ) # Send a reply and close socket message.reply_channel.send({ 'text': 'OK', 'close': True, })
routing.py: urls.py for Channels
message.user: like request.user
message.channel_session: per-socket sessions
Groups broadcast/pub-sub
Add a channel to a Group Remove a channel from
a Group Send to a Group
Worked Examples github.com/andrewgodwin/channels-examples
Liveblog http.request Django view layer websocket.connect Add to liveblog Group
websocket.disconnect Remove from liveblog Group <Article.save> Send notification to liveblog
Chat http.request Django view layer websocket.receive Either add to room
Group or send to chat_messages websocket.disconnect Remove from room Groups chat_messages Send to room Groups
It's so easy to join! CALL NOW
Things I didn't even get to: Replacing WSGI Pluggable channel
backends Sharding and scaling It's still just runserver
A base for the future Scheduler? Retry logic? Generic Consumers?
...and much more
1.10 "Provisional"?
1.8 1.9 pip install channels
channels.readthedocs.com github.com/andrewgodwin/channels-examples
Thanks. Andrew Godwin @andrewgodwin