Skip to content

Commit b64a9d3

Browse files
authored
Subscriptions: SSE distinct connection support (#1195)
1 parent e23f6b1 commit b64a9d3

File tree

7 files changed

+847
-0
lines changed

7 files changed

+847
-0
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
# CHANGELOG
22

33

4+
## 0.25 (UNRELEASED)
5+
6+
- Added support for GraphQL subscriptions over the Server-Sent Events (SSE).
7+
8+
49
## 0.24 (2024-12-19)
510

611
- Added validation for directive declarations in `make_executable_schema` to prevent schema creation with undeclared directives.

ariadne/asgi/handlers/http.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,16 @@ async def handle(self, scope: Scope, receive: Receive, send: Send) -> None:
9393
response = await self.handle_request(request)
9494
await response(scope, receive, send)
9595

96+
async def handle_request_override(self, _: Request) -> Optional[Response]:
97+
"""Override the default request handling logic in subclasses.
98+
Is called in the `handle_request` method before the default logic.
99+
If None is returned, the default logic is executed.
100+
101+
# Required arguments:
102+
`_`: the `Request` instance from Starlette or FastAPI.
103+
"""
104+
return None
105+
96106
async def handle_request(self, request: Request) -> Response:
97107
"""Handle GraphQL request and return response for the client.
98108
@@ -115,6 +125,10 @@ async def handle_request(self, request: Request) -> Response:
115125
116126
`request`: the `Request` instance from Starlette or FastAPI.
117127
"""
128+
response = await self.handle_request_override(request)
129+
if response is not None:
130+
return response
131+
118132
if request.method == "GET":
119133
if self.execute_get_queries and request.query_params.get("query"):
120134
return await self.graphql_http_server(request)

0 commit comments

Comments
 (0)