Skip to content

Add WebSocket resource endpoint  #25

@gryphon2411

Description

@gryphon2411

As an HTTP API docs writer,
I want to have web-socket resource .rst directives,
So I can doc a web-socket resource endpoint, just like I doc HTTP resource endpoint.

As of today, doc of web-socket API resource endpoints is not out-of-the-box of this extension.

For HTTP APIs, there is a possibility to have web-socket resource endpoints (additional to the HTTP resource endpoints).

Suggested directives syntax:

.. http:ws:: <url>

:server-event <event-name>:
:client-event <event-name>:

Example, for a web-socket API endpoint (in the light of the this extension official docs):

.. http:ws:: /users/(int:user_id)/posts/

   Returns a post that the user (`user_id`) just added.

   :reqheader cookie:
   :server-event add:

   **Example response**:

   .. sourcecode:: json

        {
          "post_id": 54321,
          "author_id": 123,
          "tags": ["server", "web"],
          "subject": "Tomcat doesn't work"
        }

   :statuscode 401: user is not authorized.

Might be rendered to:
rendered web-socket directive

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions