Upgrade to Pro — share decks privately, control downloads, hide ads and more …

A Brief History of Channels

A Brief History of Channels

A talk I gave at DjangoCon Europe 2016

Andrew Godwin

March 31, 2016
Tweet

More Decks by Andrew Godwin

Other Decks in Programming

Transcript

  1. 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, })
  2. Liveblog http.request Django view layer websocket.connect Add to liveblog Group

    websocket.disconnect Remove from liveblog Group <Article.save> Send notification to liveblog
  3. 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
  4. Things I didn't even get to: Replacing WSGI Pluggable channel

    backends Sharding and scaling It's still just runserver