1
1
import asyncio
2
2
import logging
3
- import sys
4
3
from asyncio import Event
5
4
from typing import AsyncGenerator , Tuple
6
5
7
- import aiohttp
8
- from rsocket .transports .asyncwebsockets_transport import websocket_client
9
-
10
- from rsocket .transports .aiohttp_websocket import TransportAioHttpClient
11
-
12
6
from reactivestreams .publisher import Publisher
13
7
from reactivestreams .subscriber import Subscriber
14
8
from reactivestreams .subscription import Subscription
15
9
from rsocket .extensions .helpers import route , composite , authenticate_simple
16
10
from rsocket .extensions .mimetypes import WellKnownMimeTypes
17
- from rsocket .helpers import single_transport_provider
18
11
from rsocket .payload import Payload
19
12
from rsocket .rsocket_client import RSocketClient
20
13
from rsocket .streams .stream_from_async_generator import StreamFromAsyncGenerator
21
- from rsocket .transports .tcp import TransportTCP
14
+ from rsocket .transports .asyncwebsockets_transport import websocket_client
22
15
23
16
24
17
def sample_publisher (wait_for_requester_complete : Event ,
@@ -64,8 +57,8 @@ def on_complete(self):
64
57
logging .info ('Completed from server on channel' )
65
58
self ._wait_for_responder_complete .set ()
66
59
67
- async def request_channel (client : RSocketClient ):
68
60
61
+ async def request_channel (client : RSocketClient ):
69
62
channel_completion_event = Event ()
70
63
requester_completion_event = Event ()
71
64
payload = Payload (b'The first item in the stream' , composite (
@@ -84,9 +77,9 @@ async def request_channel(client: RSocketClient):
84
77
85
78
86
79
async 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 )
90
83
91
84
92
85
async def command ():
@@ -95,4 +88,4 @@ async def command():
95
88
96
89
97
90
if __name__ == '__main__' :
98
- asyncio .run (command ())
91
+ asyncio .run (command ())
0 commit comments