File tree 1 file changed +5
-4
lines changed
1 file changed +5
-4
lines changed Original file line number Diff line number Diff line change 8
8
import aiohttp
9
9
from aiohttp import hdrs , web
10
10
from aiohttp .client_ws import ClientWSTimeout
11
+ from aiohttp .http import WSCloseCode
11
12
12
13
if sys .version_info >= (3 , 11 ):
13
14
import asyncio as async_timeout
@@ -643,12 +644,12 @@ async def handler(request):
643
644
app .router .add_route ("GET" , "/" , handler )
644
645
645
646
client = await aiohttp_client (app )
646
- resp = await client .ws_connect ("/" , heartbeat = 0.05 )
647
-
648
- await resp .receive ()
649
- await resp .receive ()
647
+ resp = await client .ws_connect ("/" , heartbeat = 0.1 )
650
648
649
+ # Connection should be closed roughly after 1.5x heartbeat.
650
+ await asyncio .sleep (0.2 )
651
651
assert ping_received
652
+ assert resp .close_code is WSCloseCode .ABNORMAL_CLOSURE
652
653
653
654
654
655
async def test_send_recv_compress (aiohttp_client : Any ) -> None :
You can’t perform that action at this time.
0 commit comments