








































Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
The process of building a chat app using HTML, JavaScript, and Python. It covers setting up the file structure, creating functions for loading and sending chat messages, and using AJAX to make HTTP requests from JavaScript after the page loads. The app uses a Python web server to save and load chat history from a file.
Typology: Lecture notes
1 / 48
This page cannot be seen from the preview
Don't miss anything!









































JSON.stringify(jsData) JSON.parse(jsonString) import json json.dumps(python_data) json.loads(json_string) We've seen json.loads to convert from a JSON string to python type To complete the conversions we have
Whenever we send data over the Internet we'll covert it to a JSON string
Goal: Build an app where users can send chat messages to all other users To build this app we will need
chat history to the user
chat message
messages
will persist ever if the server restarts
Python back-end
Note: There are many possible ways to build this app We'll walk through only one possible design, though there are many other solutions
Message:
Send
Message:
Send
Download the JavaScript portion of the app
****
Message:
Send
Add an empty div where our JavaScript can write the chat history
Message:
Send
Add 2 new HTML elements
clicks it
This file will store all of the chat history We won't add anything to this file manually, but we'll manually create it as an empty file This file will store one chat message per line