-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Enhance WebSocket error handling and message queueing logic
Introduced panic recovery in readMessages and SendMessage to prevent application crashes due to unexpected panics. Improved handling of closed channels in writeMessages to avoid runtime errors. Added checks for context cancellation (Context.Done) in SendMessage and writeMessages for better connection management. Used a mutex to ensure thread-safe access to the WebSocket connection when sending messages in writeMessages. Enhanced error handling when the outgoing message buffer is full, ensuring graceful connection closure. Updated SendMessage to clarify behavior during context cancellation and buffer overflow scenarios.
- Loading branch information
Showing
2 changed files
with
31 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters