0
0
Raspberry Piprogramming~5 mins

WebSocket for live updates in Raspberry Pi - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What is a WebSocket?
A WebSocket is a way for a computer to keep a connection open with a server so they can send messages back and forth instantly, like a phone call instead of sending letters.
Click to reveal answer
beginner
Why use WebSocket for live updates on a Raspberry Pi?
WebSocket lets the Raspberry Pi get new information right away without asking again and again, saving power and making updates faster.
Click to reveal answer
intermediate
Which protocol does WebSocket use to start a connection?
WebSocket starts with an HTTP handshake, then switches to the WebSocket protocol for continuous communication.
Click to reveal answer
intermediate
How does a Raspberry Pi listen for WebSocket messages in Python?
It uses a WebSocket client library to connect and then waits for messages in a loop, reacting when new data arrives.
Click to reveal answer
beginner
What is a common use case of WebSocket on Raspberry Pi?
To show live sensor data or control devices instantly from a web page without refreshing the page.
Click to reveal answer
What makes WebSocket different from regular HTTP requests?
AIt requires no internet connection.
BIt sends data only once and closes immediately.
CIt keeps the connection open for instant two-way communication.
DIt uses email to send messages.
Which language is commonly used on Raspberry Pi to handle WebSocket connections?
AHTML
BPython
CCSS
DSQL
What is the first step in establishing a WebSocket connection?
ASending a text message
BRunning a SQL query
CClosing the connection
DHTTP handshake
Why is WebSocket good for live updates?
ABecause it sends updates instantly without waiting.
BBecause it stores data in a database.
CBecause it uses less electricity than a light bulb.
DBecause it only works offline.
Which of these is NOT a feature of WebSocket?
AAutomatically saves data to disk
BContinuous connection
CTwo-way communication
DInstant message delivery
Explain how WebSocket helps a Raspberry Pi show live sensor data on a web page.
Think about how the Pi and browser talk without waiting.
You got /4 concepts.
    Describe the steps to set up a WebSocket client on a Raspberry Pi using Python.
    Focus on the code flow from start to receiving data.
    You got /4 concepts.