Skip to content

Commit ec37cb0

Browse files
authored
PhoenixChannelWebsocketsTransport inherits WebsocketsBase (#280)
1 parent e2d2085 commit ec37cb0

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

gql/transport/phoenix_channel_websockets.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
TransportQueryError,
1212
TransportServerError,
1313
)
14-
from .websockets import WebsocketsTransport
14+
from .websockets_base import WebsocketsTransportBase
1515

1616
log = logging.getLogger(__name__)
1717

@@ -24,7 +24,7 @@ def __init__(self, query_id: int) -> None:
2424
self.unsubscribe_id: Optional[int] = None
2525

2626

27-
class PhoenixChannelWebsocketsTransport(WebsocketsTransport):
27+
class PhoenixChannelWebsocketsTransport(WebsocketsTransportBase):
2828
"""The PhoenixChannelWebsocketsTransport is an async transport
2929
which allows you to execute queries and subscriptions against an `Absinthe`_
3030
backend using the `Phoenix`_ framework `channels`_.
@@ -54,7 +54,7 @@ def __init__(
5454
self.subscriptions: Dict[str, Subscription] = {}
5555
super(PhoenixChannelWebsocketsTransport, self).__init__(*args, **kwargs)
5656

57-
async def _send_init_message_and_wait_ack(self) -> None:
57+
async def _initialize(self) -> None:
5858
"""Join the specified channel and wait for the connection ACK.
5959
6060
If the answer is not a connection_ack message, we will return an Exception.
@@ -131,6 +131,9 @@ async def _send_stop_message(self, query_id: int) -> None:
131131

132132
await self._send(unsubscribe_message)
133133

134+
async def _stop_listener(self, query_id: int) -> None:
135+
await self._send_stop_message(query_id)
136+
134137
async def _send_connection_terminate_message(self) -> None:
135138
"""Send a phx_leave message to disconnect from the provided channel."""
136139

@@ -148,6 +151,9 @@ async def _send_connection_terminate_message(self) -> None:
148151

149152
await self._send(connection_terminate_message)
150153

154+
async def _connection_terminate(self):
155+
await self._send_connection_terminate_message()
156+
151157
async def _send_query(
152158
self,
153159
document: DocumentNode,

0 commit comments

Comments
 (0)