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

feat: support custom websocket dialer #197

Merged
merged 2 commits into from
Nov 27, 2024

Conversation

yunyu950908
Copy link
Contributor

Support WebSocketClient to use WithDialer for passing a custom dialer config, such as handshake timeout and proxy settings. This would be similar to how the HTTP REST API client supports WithHTTPClient for using a custom HTTP client.

Comment on lines -41 to +53
c, _, err := websocket.DefaultDialer.Dial(url, nil)
var c *websocket.Conn
var err error
if s.client.dialer != nil {
c, _, err = s.client.dialer.Dial(url, nil)
} else {
c, _, err = websocket.DefaultDialer.Dial(url, nil)
}
Copy link
Owner

Choose a reason for hiding this comment

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

It looks good functionally 👍

As an implementation, there may be room for refactoring.
Because the same writing style is used in multiple places

Copy link
Owner

@hirokisan hirokisan left a comment

Choose a reason for hiding this comment

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

LGTM 👍

Thanks for your contribution!

@hirokisan hirokisan merged commit 578cde3 into hirokisan:main Nov 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants