Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Tags: albeebe/websocket

Tags

v1.0.2

Toggle v1.0.2's commit message
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.

v1.0.1

Toggle v1.0.1's commit message
Send disconnection notification regardless of error presence

This change ensures the Disconnected channel is notified when the connection is closed, regardless of whether an error occurred. Previously, the notification was only sent if an error was present.

v1.0.0

Toggle v1.0.0's commit message
Add unit tests for WebSocket client and initialize Go module

- Added unit tests for the WebSocket client to verify connection establishment, message sending, message receiving, and disconnection handling.
- Created Go module file (go.mod) to manage dependencies, including Gorilla WebSocket and Testify libraries.
- Ensured robust testing of WebSocket communication flow using httptest servers.