Skip to content

Incomplete Websockets Documentation #1144

Closed
@frederikaalund

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.

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions