You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/quick-start-django.rst
+6Lines changed: 6 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -265,6 +265,12 @@ Next Steps
265
265
266
266
Now that you have a working Django WebSocket consumer with Chanx:
267
267
268
+
**Tutorial:**
269
+
270
+
* :doc:`tutorial-django/prerequisites` - **Follow the comprehensive Django tutorial** to build a complete real-time application with chat, AI assistants, background tasks, and testing
271
+
272
+
**Documentation:**
273
+
268
274
* :doc:`user-guide/consumers-decorators` - Learn more about consumers and decorators
269
275
* :doc:`user-guide/framework-integration` - Explore Django-specific features
270
276
* :doc:`user-guide/asyncapi` - Learn about AsyncAPI documentation generation
Copy file name to clipboardExpand all lines: docs/quick-start-fastapi.rst
+6Lines changed: 6 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -271,6 +271,12 @@ Next Steps
271
271
272
272
Now that you have a working FastAPI WebSocket consumer with Chanx:
273
273
274
+
**Tutorial:**
275
+
276
+
* :doc:`tutorial-fastapi/prerequisites` - **Follow the comprehensive FastAPI tutorial** to build a complete real-time application with system echo, room chat, background jobs, and multi-layer messaging
277
+
278
+
**Documentation:**
279
+
274
280
* :doc:`user-guide/consumers-decorators` - Learn more about consumers and decorators
275
281
* :doc:`user-guide/framework-integration` - Explore FastAPI-specific features
276
282
* :doc:`user-guide/asyncapi` - Learn about AsyncAPI documentation generation
The ``handle_new_chat_message`` method demonstrates this:
198
+
199
+
- Return type is ``None`` (not sending directly to sender)
200
+
- Use ``output_type`` parameter in ``@ws_handler`` for API documentation
201
+
- Call ``broadcast_message()`` explicitly to send to all group members
202
+
- ``exclude_current=True`` means the sender won't receive their own message
203
+
204
+
.. note::
205
+
206
+
You'll see more advanced messaging patterns, including server-to-server communication with event handlers, in Part 4.
207
+
208
+
AsyncAPI Documentation Mapping
209
+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
210
+
211
+
The ``@ws_handler`` decorator generates AsyncAPI **RECEIVE** actions (documenting what messages clients can send). When handlers have a return type or ``output_type`` parameter, the RECEIVE action includes a **reply field** describing the response message.
212
+
213
+
.. seealso::
214
+
215
+
For detailed information about AsyncAPI mapping, see :doc:`../user-guide/consumers-decorators` → AsyncAPI Documentation Mapping section.
The ``@event_handler`` decorator generates AsyncAPI **SEND** actions (server-initiated messages). Only the output type (message sent to client) is documented. The input event type is NOT documented in AsyncAPI since it comes from internal sources (Celery, management commands, etc.), not from WebSocket clients.
557
+
558
+
.. seealso::
559
+
560
+
For detailed information about AsyncAPI mapping, see :doc:`../user-guide/consumers-decorators` → AsyncAPI Documentation Mapping section.
561
+
466
562
.. tip::
467
563
468
564
**Optional: Generic Type Parameter for Better Type Hints**
This catches bugs during development before runtime, providing better IDE autocomplete and static analysis. The generic type doesn't affect runtime behavior.
499
595
500
-
.. important::
501
-
502
-
**Key Difference:**
503
-
504
-
- ``@ws_handler`` - Handles messages from **WebSocket clients**
505
-
- ``@event_handler`` - Handles messages from **channel layer** (server-to-server)
Copy file name to clipboardExpand all lines: docs/tutorial-fastapi/cp1-system-echo.rst
+9Lines changed: 9 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -245,6 +245,15 @@ When broadcasting:
245
245
246
246
You'll see more advanced messaging patterns, including server-to-server communication with event handlers, in Part 3.
247
247
248
+
AsyncAPI Documentation Mapping
249
+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
250
+
251
+
The ``@ws_handler`` decorator generates AsyncAPI **RECEIVE** actions (documenting what messages clients can send). When handlers have a return type or ``output_type`` parameter, the RECEIVE action includes a **reply field** describing the response message.
252
+
253
+
.. seealso::
254
+
255
+
For detailed information about AsyncAPI mapping, see :doc:`../user-guide/consumers-decorators` → AsyncAPI Documentation Mapping section.
The ``@event_handler`` decorator generates AsyncAPI **SEND** actions (server-initiated messages). Only the output type (message sent to client) is documented. The input event type is NOT documented in AsyncAPI since it comes from internal sources (ARQ workers, HTTP endpoints, etc.), not from WebSocket clients.
520
+
521
+
.. seealso::
522
+
523
+
For detailed information about AsyncAPI mapping, see :doc:`../user-guide/consumers-decorators` → AsyncAPI Documentation Mapping section.
0 commit comments