python-hyper / wsproto

Sans-IO WebSocket protocol implementation
https://wsproto.readthedocs.io/
MIT License
266 stars 39 forks source link

Improve CloseConnection behavior (close #59) #92

Closed touilleMan closed 5 years ago

touilleMan commented 5 years ago

This introduce the ConnectionStateError exception that will be raised when send a CloseConnection event when the connection is not in OPEN state. On top of that a WSConnection.opened property has been added to help user determine when it should close the connection.

pgjones commented 5 years ago

@touilleMan Thanks, could you comment on the discussion in #85? We are going through a rework of the API at the moment and this touches part of it.

pgjones commented 5 years ago

@touilleMan Thanks for this PR. I've created a general LocalProtocolError and then built this functionality on top in 2b38d3a7c0ebcb6eea39f00c4ab2137371fe3474. Is it missing anything?

touilleMan commented 5 years ago

@pgjones yep, looks good to me ;-)

I guess we can close this PR then