Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GraphQL over SSE documentation #185

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

Conversation

danplischke
Copy link

Documentation for mirumee/ariadne#1195

Copy link
Collaborator

@rafalp rafalp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove all hard linebreaks from the markdown paragraphs so they won't get parsed into <br /> by docusaurus.

@@ -472,3 +472,60 @@ graphql = GraphQL(
),
)
```

## Using Server-Sent Events Protocol
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We are using double blank line between headers for visual separation in markdown too:

Suggested change
## Using Server-Sent Events Protocol
## Using Server-Sent Events Protocol


## Using Server-Sent Events Protocol

In addition to subscriptions over WebSockets, Ariadne also allows an alternative subscriptions approach, `graphql-sse`,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be reworded and hard linebreak removed:

Instead of WebSockets, [Server-Sent Events (SSE)](https://github.com/enisdenjo/graphql-sse/blob/master/PROTOCOL.md) can be used as a transmission protocol for subscriptions. This approach uses single, long-lived HTTP connection to push data to clients.

Server-Sent Events (SSE) allow servers to push data to web clients over HTTP through a single, long-lived connection.

To enable subscriptions over Server-Sent Events, initialize the `ariadne.asgi.GraphQL` app with
a `ariadne.contrib.sse.GraphQLHTTPSSEHandler` instance:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
a `ariadne.contrib.sse.GraphQLHTTPSSEHandler` instance:
an `ariadne.contrib.sse.GraphQLHTTPSSEHandler` instance:

Subscriptions can be consumed using the [graphql-sse](https://github.com/enisdenjo/graphql-sse/) JavaScript client
library or any other compatible implementation.

> The `GraphQLHTTPSSEHandler` only supports asynchronous servers, due to the nature of subscriptions.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
> The `GraphQLHTTPSSEHandler` only supports asynchronous servers, due to the nature of subscriptions.
> The `GraphQLHTTPSSEHandler` requires the ASGI server to work.

@danplischke
Copy link
Author

Thanks for the feedback @rafalp! Everything has been included in the recent commit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants