Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incomplete Websockets Documentation #1144

Closed
frederikaalund opened this issue Sep 7, 2016 · 4 comments
Closed

Incomplete Websockets Documentation #1144

frederikaalund opened this issue Sep 7, 2016 · 4 comments
Labels

Comments

@frederikaalund
Copy link
Contributor

frederikaalund commented Sep 7, 2016

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.

@asvetlov
Copy link
Member

asvetlov commented Sep 7, 2016

Agree with implicit catching closing message in __anext__.
Would you make a Pull Request?

@frederikaalund
Copy link
Contributor Author

Agree with implicit catching closing message in anext.

Great.

Would you make a Pull Request?

Yeah sure, I can do that.

frederikaalund added a commit to frederikaalund/aiohttp that referenced this issue Sep 7, 2016
frederikaalund added a commit to frederikaalund/aiohttp that referenced this issue Oct 18, 2016
frederikaalund added a commit to frederikaalund/aiohttp that referenced this issue Oct 19, 2016
frederikaalund added a commit to frederikaalund/aiohttp that referenced this issue Oct 19, 2016
frederikaalund pushed a commit to frederikaalund/aiohttp that referenced this issue Oct 19, 2016
asvetlov pushed a commit that referenced this issue Oct 21, 2016
* Websockets: Stop iteration when connection closes.

See issue #1144.

* WebsocketResponse: Async for now stops iteration when WSMsgType.Closed is passed down (and not just WsMsgType.Close).

* Tests: Added tests for the async for functionality of the websocket response and websocket client response.

* Moved python3.5 'async for closed' tests unto the test_py35 directory equivalents.

* Added Frederik Peter Aalund to CONTRIBUTORS.txt

* Updated CHANGES.rst to reflect that #1144 is now fixed.
@asvetlov
Copy link
Member

Fixed by #1145

@lock
Copy link

lock bot commented Oct 29, 2019

This thread has been automatically locked since there has not been
any recent activity after it was closed. Please open a new issue for
related bugs.

If you feel like there's important points made in this discussion,
please include those exceprts into that new issue.

@lock lock bot added the outdated label Oct 29, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Oct 29, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants