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

Catch exceptions while sending websocket messages #3046

Merged
merged 1 commit into from
Nov 9, 2022

Conversation

jpelgrom
Copy link
Member

@jpelgrom jpelgrom commented Nov 7, 2022

Summary

Fix #3038 by not crashing the app when the connection is closed while a message was still being sent on the websocket, and instead returning null like what is done for invalid messages.

(Yes there should probably be better error handling but that also applies to returned messages/could be encapsulated in SocketResponse in the future. This PR simply provides a quick fix.)

Screenshots

n/a

Link to pull request in Documentation repository

n/a

Any other notes

 - Don't crash the app when the connection is closed while a message was still being sent on the websocket. Instead return null like what is done for invalid messages.
Copy link
Member

@dshokouhi dshokouhi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the quick fix, always better to make sure we don't crash!

@JBassett JBassett merged commit e1c636e into home-assistant:master Nov 9, 2022
@jpelgrom jpelgrom deleted the fix-3038 branch November 9, 2022 21:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Recent Crash: Websocket IOException during closing socket
3 participants