|
1 | 1 | from inspect import isawaitable
|
2 | 2 | from graphene_django.settings import graphene_settings
|
3 | 3 | from graphql.execution.executors.asyncio import AsyncioExecutor
|
4 |
| -from rx import Observer |
5 | 4 | from ..base import BaseConnectionContext, BaseSubscriptionServer
|
6 | 5 | from ..constants import GQL_CONNECTION_ACK, GQL_CONNECTION_ERROR, GQL_COMPLETE
|
7 | 6 | from ..observable_aiter import setup_observable_extension
|
8 | 7 |
|
9 | 8 | setup_observable_extension()
|
10 | 9 |
|
11 | 10 |
|
12 |
| -class SubscriptionObserver(Observer): |
13 |
| - def __init__( |
14 |
| - self, connection_context, op_id, send_execution_result, send_error, on_close |
15 |
| - ): |
16 |
| - self.connection_context = connection_context |
17 |
| - self.op_id = op_id |
18 |
| - self.send_execution_result = send_execution_result |
19 |
| - self.send_error = send_error |
20 |
| - self.on_close = on_close |
21 |
| - |
22 |
| - def on_next(self, value): |
23 |
| - self.send_execution_result(self.connection_context, self.op_id, value) |
24 |
| - |
25 |
| - def on_completed(self): |
26 |
| - self.on_close(self.connection_context) |
27 |
| - |
28 |
| - def on_error(self, error): |
29 |
| - self.send_error(self.connection_context, self.op_id, error) |
30 |
| - |
31 |
| - |
32 | 11 | class ChannelsConnectionContext(BaseConnectionContext):
|
| 12 | + |
33 | 13 | async def send(self, data):
|
34 | 14 | await self.ws.send_json(data)
|
35 | 15 |
|
|
0 commit comments