Rewrite gateway to use aiohttp instead of websockets

This commit is contained in:
Rapptz
2020-04-07 21:53:55 -04:00
parent 45cb231161
commit b8154e365f
8 changed files with 97 additions and 92 deletions

View File

@ -32,7 +32,6 @@ import sys
import traceback
import aiohttp
import websockets
from .user import User, Profile
from .asset import Asset
@ -497,9 +496,7 @@ class Client:
GatewayNotFound,
ConnectionClosed,
aiohttp.ClientError,
asyncio.TimeoutError,
websockets.InvalidHandshake,
websockets.WebSocketProtocolError) as exc:
asyncio.TimeoutError) as exc:
self.dispatch('disconnect')
if not reconnect:
@ -632,7 +629,11 @@ class Client:
_cleanup_loop(loop)
if not future.cancelled():
return future.result()
try:
return future.result()
except KeyboardInterrupt:
# I am unsure why this gets raised here but suppress it anyway
return None
# properties