Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions aioari/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@
log = logging.getLogger(__name__)


class WSConnectionClosed(Exception):
pass


class Client(object):
"""Async ARI Client object.

Expand Down Expand Up @@ -103,8 +107,8 @@ async def __run(self, ws):
msg = await ws.receive()
if msg is None:
return ## EOF
elif msg.type in {aiohttp.WSMsgType.CLOSED, aiohttp.WSMsgType.CLOSING}:
break
elif msg.type in {aiohttp.WSMsgType.CLOSE, aiohttp.WSMsgType.CLOSED, aiohttp.WSMsgType.CLOSING}:
raise WSConnectionClosed("WS connection closed")
elif msg.type != aiohttp.WSMsgType.TEXT:
log.warning("Unknown JSON message type: %s", repr(msg))
continue # ignore
Expand Down