Skip to content

Commit ce611d7

Browse files
committed
Add tutorial.
1 parent 33b38ee commit ce611d7

34 files changed

Lines changed: 2422 additions & 6 deletions

docs/conf.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,11 @@
9595
code_url = f"https://github.com/aaugustin/websockets/blob/{commit}"
9696

9797
def linkcode_resolve(domain, info):
98-
assert domain == "py"
98+
# Non-linkable objects from the starter kit in the tutorial.
99+
if domain == "js" or info["module"] == "connect4":
100+
return
101+
102+
assert domain == "py", "expected only Python objects"
99103

100104
mod = importlib.import_module(info["module"])
101105
if "." in info["fullname"]:

docs/howto/heroku.rst

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ Here's the implementation of the app, an echo server. Save it in a file called
4242
``app.py``:
4343

4444
.. literalinclude:: ../../example/deployment/heroku/app.py
45+
:language: text
4546

4647
Heroku expects the server to `listen on a specific port`_, which is provided
4748
in the ``$PORT`` environment variable. The app reads it and passes it to
@@ -62,6 +63,7 @@ In order to build the app, Heroku needs to know that it depends on websockets.
6263
Create a ``requirements.txt`` file containing this line:
6364

6465
.. literalinclude:: ../../example/deployment/heroku/requirements.txt
66+
:language: text
6567

6668
Heroku also needs to know how to run the app. Create a ``Procfile`` with this
6769
content:
@@ -86,7 +88,7 @@ The app is ready. Let's deploy it!
8688

8789
.. code-block:: console
8890
89-
$ git push heroku main
91+
$ git push heroku
9092
9193
... lots of output...
9294

docs/intro/index.rst

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,19 +16,34 @@ websockets requires Python ≥ 3.7.
1616

1717
It doesn't have any dependencies.
1818

19+
.. _install:
20+
1921
Installation
2022
------------
2123

22-
Install websockets with::
24+
Install websockets with:
25+
26+
.. code-block:: console
2327
24-
pip install websockets
28+
$ pip install websockets
2529
2630
Wheels are available for all platforms.
2731

28-
First steps
32+
Tutorial
33+
--------
34+
35+
Learn how to build an real-time web application with websockets.
36+
37+
.. toctree::
38+
39+
tutorial1
40+
tutorial2
41+
tutorial3
42+
43+
In a hurry?
2944
-----------
3045

31-
If you're in a hurry, check out these examples.
46+
Check out these examples.
3247

3348
.. toctree::
3449

0 commit comments

Comments
 (0)