Description
The current websockets documentation only handles two message types: MsgType.text and MsgType.error. However, a runtime error may occur if MsgType.closed is not handled as well. This should be clear from the official documentation.
It took me a long time to figure out why my program returned errors because of this. Now that we are at it: Why not simply catch the MsgType.closed in the __anext__ function? It is unintuitive that autoclose=True (which is also the default) doesn't deal with MsgType.closed when it deals with MsgType.close. I realize that the former is your own internal message while the latter is part of the WS standard.
Side note: In the web_ws example this is implicitly handled correctly through an else clause.
I'm using Python 3.5.1 and Aiohttp 0.22.5.