Closed dvonthenen closed 2 months ago
The recent changes focus on refining the Client
and ClientOptions
structs. The alterations include renaming receiver variables, adding a new controlMessage
type, enhancing connection management with new functions, and adjusting parameters in several methods. These updates aim to improve the overall robustness, error handling, and message inspection capabilities within the client package.
File | Summary |
---|---|
pkg/client/interfaces/options.go |
Renamed the receiver variable from c to o in the InspectMessage method of ClientOptions . |
pkg/client/live/client.go |
Introduced controlMessage type, added and adjusted parameters in various methods, and added new functions to enhance connection management and error handling. |
pkg/client/live/constants.go |
Removed flashInitialDelay and added UseOfClosedSocket constant. |
sequenceDiagram
participant Client
participant Server
Client->>Server: Connect()
Server-->>Client: Success or Error
Client->>Server: AttemptReconnect()
Server-->>Client: Success or Error
sequenceDiagram
participant Client
participant Server
Note right of Client: New Connection Flow
Client->>Server: Connect(lock)
Server-->>Client: Success or Error
Client->>Server: AttemptReconnect(lock)
Server-->>Client: Success or Error
Client->>Server: KeepAlive
Server-->>Client: Ping/Pong
Client->>Server: closeStream(lock)
Server-->>Client: Connection Closed
This sequence diagram illustrates how the new connection flow incorporates additional parameters and checks to enhance the reliability of the client-server interactions.
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?
Proposed changes
This PR makes all WebSocket Write operations atomic. Meaning the connection must exist and write under the same mutex. That is where the disconnect was in the logic. In timing related situations, we might test the connection and then go into another mutex to where the connection is no longer valid, but we are attempting to write to the socket.
Tested using all
examples
andtests
apps.Types of changes
What types of changes does your code introduce to the community Go SDK? Put an
x
in the boxes that applyChecklist
Put an
x
in the boxes that apply. You can also fill these out after creating the PR. If you're unsure about any of them, don't hesitate to ask. We're here to help! This is simply a reminder of what we are going to look for before merging your code.Further comments
NA
Summary by CodeRabbit
New Features
KeepAlive
andFinalize
functions for better control over live connections.Refactor
Chores