AQA A-Level Computer Science 7517
Fundamentals of Programming
Fundamentals of Data Structures
Fundamentals of Algorithms
Theory of Computation
Fundamentals of Data Representation
Fundamentals of Computer Systems
Fundamentals of Computer Organisation and Architecture
Fundamentals of Communication and Networking
Consequences of Uses of Computing
Systematic Approach to Problem Solving
Fundamentals of Databases
Big Data
Fundamentals of Communication and Networking
Client server model
- 3 things to know
- Paper 2
Overview
Recall questions on request-response, why Websockets are used and what full-duplex buys you, CRUD, REST, and JSON against XML.
What you need to know
Answer each one before you reveal it.
Describe the parts involved when a web page updates its contents from a database without reloading.
Why does the compactness of JSON matter in a web application specifically?
Questions from this subtopic
Each one with the model answer underneath.
- 1
Describe the client server model.
Model answer
In the client server model one program, the client, sends a request message to another program, the server, asking for a service or a resource. The server, which runs continuously waiting for such requests, carries out the work and responds by replying with a response message to the client. The client opens every exchange, and in the plain request-and-response form the server speaks only when it is spoken to. Once a client has opened a Websocket connection, however, that restriction is lifted and the server may send data unprompted.
- 2
Give an everyday example of the request-response exchange.
Model answer
A browser sends a request to a web server naming the page it wants; the web server finds or generates that page and sends back a response containing a status code and the page itself. The browser then sends further requests for each image and stylesheet the page refers to, and each is answered with its own response.
- 3
What is the Websocket protocol?
Model answer
It is a protocol, with an accompanying programming interface, that turns an ordinary web connection into a lasting full-duplex channel carried over TCP: once established it stays open, and either end — browser or server — may transmit at any moment, both at once if need be. That is the point of it. With plain request-and-response the browser must keep asking whether anything has changed, whereas here the server can push out a new share price, chat message or opponent's move the instant it arises, with no polling and no fresh connection to establish each time.
- 4
Why is the Websocket protocol used?
Model answer
Because the ordinary request-response model cannot handle data that arrives at the server unpredictably. Under request-response the server can only speak when spoken to, so to learn about new data the client must keep asking, over and over — polling — which either wastes an enormous number of requests on 'nothing new' or introduces delay while the client waits until its next poll. A Websocket keeps one connection open, so the server can push data to the client the instant it exists. Because the connection is persistent, the cost of setting it up is paid once rather than on every message, and because it is full-duplex, both sides can transmit simultaneously. The result is much lower latency and much less overhead for anything that updates continuously.
- 5
Where would you use a Websocket connection?
Model answer
In anything where the server must inform the client of events as they happen: live chat and messaging, notifications, live sports scores or news feeds, collaborative editing where several people work on one document at once, live financial price feeds, multiplayer games, and dashboards showing changing data.
- 6
What does 'full-duplex' mean, and why does it matter here?
Model answer
Full-duplex means both parties can transmit at the same time in both directions, rather than taking it in turns. It matters because it removes the strict alternation of request and response: the client can send an input while the server is simultaneously sending an update, which is exactly what real-time interaction requires.
Other ways to work this
The same content, four other ways.
What is inside Levo
Six ways to work the same material.
Every question in Fundamentals of Communication and Networking, on a schedule.
Attempt a question from memory, write the correct version, then attempt it again. Levo records the jump between your first attempt and your last, and brings each question back on the day you are due to forget it.
Or £46 a year, about £3.83 a month. Cancel anytime.