Unit 2: Webpage Applications
2025-01-12
Requirements:
<div>...</div><button>js codeAdvantages
Limitations
Requirements
| Method | Best For | Complexity |
|---|---|---|
| MJPEG Stream | OpenCV processing, webcam feeds, Matplotlib plots. | Low |
| WebSockets | Interactive animations (games, real-time dashboards) | High |
| Server Sent Events | One-way data updates (moving a ball based on server math). | Medium |
| Static Files | Serving animated .mp4 or .gif files stored on the server. | Very Low |
Asynchronous JavaScript and XML
the art of asking a server for data without refreshing the entire page
It is possible to interact with a server without the browser screen flickering white and reloading.
While the “X” stands for XML, modern developers almost exclusively use JSON because it’s lighter and easier to read.
An event occurs: A button is clicked or a timer goes off.
Request sent: JavaScript creates an object to talk to the server.
Server processes: The server fetches data (like from a database).
Response received: The server sends data back to the browser.
Page updated: JavaScript updates the specific part of the page with the new data.
| State | Name | Description |
|---|---|---|
| 0 | UNSENT | Client has been created. open() not called yet. |
| 1 | OPENED | open() has been called. |
| 2 | HEADERS_RECEIVED | send() has been called, and headers are available. |
| 3 | LOADING | Downloading; responseText holds partial data. |
| 4 | DONE | The operation is complete. Time to use the data! |
Plaintext
/flask_app
├── app.py # Your Python logic
├── static # Resource directory (icons, graphics)
│ └── favicon.ico
└── templates/ # HTML files
├── index.html
└── edit.html
Plaintext
/flask_app
├── tempcnx.html
├── tempcnx.js
└── tempcnx.css
IT315 MOBILE APPLICATION DEVELOPMENT