11import asyncio
22import logging
3- import sys
43from asyncio import Event
54from typing import AsyncGenerator , Tuple
65
7- import aiohttp
8- from rsocket .transports .asyncwebsockets_transport import websocket_client
9-
10- from rsocket .transports .aiohttp_websocket import TransportAioHttpClient
11-
126from reactivestreams .publisher import Publisher
137from reactivestreams .subscriber import Subscriber
148from reactivestreams .subscription import Subscription
159from rsocket .extensions .helpers import route , composite , authenticate_simple
1610from rsocket .extensions .mimetypes import WellKnownMimeTypes
17- from rsocket .helpers import single_transport_provider
1811from rsocket .payload import Payload
1912from rsocket .rsocket_client import RSocketClient
2013from rsocket .streams .stream_from_async_generator import StreamFromAsyncGenerator
21- from rsocket .transports .tcp import TransportTCP
14+ from rsocket .transports .asyncwebsockets_transport import websocket_client
2215
2316
2417def sample_publisher (wait_for_requester_complete : Event ,
@@ -64,8 +57,8 @@ def on_complete(self):
6457 logging .info ('Completed from server on channel' )
6558 self ._wait_for_responder_complete .set ()
6659
67- async def request_channel (client : RSocketClient ):
6860
61+ async def request_channel (client : RSocketClient ):
6962 channel_completion_event = Event ()
7063 requester_completion_event = Event ()
7164 payload = Payload (b'The first item in the stream' , composite (
@@ -84,9 +77,9 @@ async def request_channel(client: RSocketClient):
8477
8578
8679async def application (serve_port : int ):
87- async with websocket_client ('http://localhost:%s/rsocket' % serve_port ,
88- metadata_encoding = WellKnownMimeTypes .MESSAGE_RSOCKET_COMPOSITE_METADATA ,) as client :
89- await request_channel (client )
80+ async with websocket_client ('http://localhost:%s/rsocket' % serve_port ,
81+ metadata_encoding = WellKnownMimeTypes .MESSAGE_RSOCKET_COMPOSITE_METADATA , ) as client :
82+ await request_channel (client )
9083
9184
9285async def command ():
@@ -95,4 +88,4 @@ async def command():
9588
9689
9790if __name__ == '__main__' :
98- asyncio .run (command ())
91+ asyncio .run (command ())
0 commit comments