
WebSockets with Python
Build the connection that lets a server speak first. You will perform the WebSocket opening handshake and encode every frame yourself, byte by byte, and then use a real library to run a live quiz-night scoreboard that pushes each score change to several viewers at once and closes cleanly.
You need HTTP with Python first: HTTP written and parsed by hand, buffered reads, struct, servers that stop on purpose, and fake connections in tests. Python Fundamentals II is recommended, not required.
You work in the site's browser editor and in a sandbox with no route to the public internet, so every live run starts a server and its clients inside one Python program on the loopback address, which is also how WebSocket code is tested in real projects. One project grows from a hand-built echo service into a tested scoreboard server that checks a token before it accepts anyone.
12
chapters
60
lessons
32
practice exercises
13
projects
Lessons are arranged in a recommended order, but you can open any lesson.
Chapter 1
When the Server Has News
Chapter 2
Asking to Switch Protocols
Chapter 3
Frames, Byte by Byte
Chapter 4
Masks and Control Frames
Chapter 5
A Conversation on Loopback
Chapter 6
The websockets Library, Without asyncio
Chapter 7
One Server, Many Clients
Chapter 8
Slow Clients and Lost Connections
Chapter 9
Who May Connect?
Chapter 10
Capstone: A Live Scoreboard
Chapter 11
A Taste of Async
Chapter 12