<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Django Channels Tutorial on CS 347</title>
    <link>/activities/channels-tutorial/</link>
    <description>Recent content in Django Channels Tutorial on CS 347</description>
    <generator>Hugo</generator>
    <language>en</language>
    <atom:link href="/activities/channels-tutorial/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>Tutorial Part 1: Basic Setup</title>
      <link>/activities/channels-tutorial/part-1/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      <guid>/activities/channels-tutorial/part-1/</guid>
      <description>&lt;div class=&#34;alert alert-info&#34; role=&#34;alert&#34;&gt;&lt;div class=&#34;h4 alert-heading&#34; role=&#34;heading&#34;&gt;Note&lt;/div&gt;&#xA;&lt;p&gt;If you encounter any issue during your coding session, please see the &lt;a href=&#34;https://channels.readthedocs.io/en/latest/topics/troubleshooting.html&#34;&gt;Channels troubleshooting&lt;/a&gt; section.&lt;/p&gt;&#xA;&lt;/div&gt;&#xA;&lt;p&gt;In this tutorial we will build a simple chat server. It will have two pages:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;An index view that lets you type the name of a chat room to join.&lt;/li&gt;&#xA;&lt;li&gt;A room view that lets you see messages posted in a particular chat room.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;The room view will use a WebSocket to communicate with the Django server and&#xA;listen for any messages that are posted.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Tutorial Part 2: Implement a Chat Server</title>
      <link>/activities/channels-tutorial/part-2/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      <guid>/activities/channels-tutorial/part-2/</guid>
      <description>&lt;p&gt;This tutorial begins where &lt;a href=&#34;../part-1/&#34;&gt;Tutorial 1&lt;/a&gt; left off.&#xA;We&amp;rsquo;ll get the room page working so that you can chat with yourself and others&#xA;in the same room.&lt;/p&gt;&#xA;&lt;h2 id=&#34;add-the-room-view&#34;&gt;Add the room view&lt;/h2&gt;&#xA;&lt;p&gt;We will now create the second view, a room view that lets you see messages&#xA;posted in a particular chat room.&lt;/p&gt;&#xA;&lt;p&gt;Create a new file &lt;code&gt;chat/templates/chat/room.html&lt;/code&gt;.&#xA;Your app directory should now look like:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-text&#34; data-lang=&#34;text&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;chat/&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    __init__.py&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    templates/&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        chat/&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;            index.html&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;            room.html&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    urls.py&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    views.py&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Create the view template for the room view in &lt;code&gt;chat/templates/chat/room.html&lt;/code&gt;:&lt;/p&gt;</description>
    </item>
    <item>
      <title>Tutorial Part 3: Rewrite Chat Server as Asynchronous</title>
      <link>/activities/channels-tutorial/part-3/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      <guid>/activities/channels-tutorial/part-3/</guid>
      <description>&lt;p&gt;This tutorial begins where &lt;a href=&#34;../part-2/&#34;&gt;Tutorial 2&lt;/a&gt; left off.&#xA;We&amp;rsquo;ll rewrite the consumer code to be asynchronous rather than synchronous&#xA;to improve its performance.&lt;/p&gt;&#xA;&lt;h2 id=&#34;rewrite-the-consumer-to-be-asynchronous&#34;&gt;Rewrite the consumer to be asynchronous&lt;/h2&gt;&#xA;&lt;p&gt;The &lt;code&gt;ChatConsumer&lt;/code&gt; that we have written is currently synchronous. Synchronous&#xA;consumers are convenient because they can call regular synchronous I/O functions&#xA;such as those that access Django models without writing special code. However&#xA;asynchronous consumers can provide a higher level of performance since they&#xA;don&amp;rsquo;t need to create additional threads when handling requests.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Tutorial Part 4: Automated Testing</title>
      <link>/activities/channels-tutorial/part-4/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      <guid>/activities/channels-tutorial/part-4/</guid>
      <description>&lt;p&gt;This tutorial begins where &lt;a href=&#34;../part-3/&#34;&gt;Tutorial 3&lt;/a&gt; left off.&#xA;We&amp;rsquo;ve built a simple chat server and now we&amp;rsquo;ll create some automated tests for it.&lt;/p&gt;&#xA;&lt;h2 id=&#34;testing-the-views&#34;&gt;Testing the views&lt;/h2&gt;&#xA;&lt;p&gt;To ensure that the chat server keeps working, we will write some tests.&lt;/p&gt;&#xA;&lt;p&gt;We will write a suite of end-to-end tests using Selenium to control a Chrome web&#xA;browser. These tests will ensure that:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;when a chat message is posted then it is seen by everyone in the same room&lt;/li&gt;&#xA;&lt;li&gt;when a chat message is posted then it is not seen by anyone in a different room&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;&lt;a href=&#34;https://www.google.com/chrome/&#34;&gt;Install the Chrome web browser&lt;/a&gt;, if you do not already have it.&lt;/p&gt;</description>
    </item>
  </channel>
</rss>
