Skip to content

Commit d01f53e

Browse files
committed
Update example code to use websockets-sansio
This makes sure everything is consistent.
1 parent e72720a commit d01f53e

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

docs/source/quickstart/counter.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,4 +34,4 @@ def slowly_increase_counter(self) -> None:
3434
server = lt.ThingServer({"counter": TestThing})
3535

3636
# We run the server using `uvicorn`:
37-
uvicorn.run(server.app, port=5000)
37+
uvicorn.run(server.app, port=5000, ws="websockets-sansio")

docs/source/tutorial/writing_a_thing.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ Our first Thing will pretend to be a light: we can set its brightness and turn i
3535
if __name__ == "__main__":
3636
import uvicorn
3737
# We run the server using `uvicorn`:
38-
uvicorn.run(server.app, port=5000)
38+
uvicorn.run(server.app, port=5000, ws="websockets-sansio")
3939
4040
If you visit `http://localhost:5000/light`, you will see the Thing Description. You can also interact with it using the OpenAPI documentation at `http://localhost:5000/docs`. If you visit `http://localhost:5000/light/brightness`, you can set the brightness of the light, and if you visit `http://localhost:5000/light/is_on`, you can see whether the light is on. Changing values on the server requires a ``PUT`` or ``POST`` request, which is easiest to do using the OpenAPI "Try it out" feature. Check that you can use a ``POST`` request to the ``toggle`` endpoint to turn the light on and off.
4141

0 commit comments

Comments
 (0)