Functional overview
Figure 16.1 shows a representation of the views, templates, and functionalities that will be built in this chapter:
Figure 16.1: Diagram of functionalities built in this chapter
In this chapter, you will implement the course_chat_room
view in the chat
application. This view will serve the template that displays the chat room for a given course. The latest chat messages will be displayed when a user joins a chat room. You will use JavaScript to establish a WebSocket connection in the browser, and you will build the ChatConsumer
WebSocket consumer to handle WebSocket connections and to exchange messages. You will use Redis to implement the channel layer that allows broadcasting messages to all users in the chat room.
The source code for this chapter can be found at https://github.com/PacktPublishing/Django-5-by-example/tree/main/Chapter16.
All Python modules used in this chapter are included in the requirements.txt
file in the source code that...