Code refactoring for streams HandleFunc

This commit is contained in:
Alex X
2024-06-14 12:48:29 +03:00
parent 1ac9d54dab
commit ecfe802065
15 changed files with 53 additions and 93 deletions
+9 -2
View File
@@ -34,8 +34,15 @@ type Client struct {
backchannel bool
}
func NewClient(url string) *Client {
return &Client{url: url}
func Dial(rawURL string) (*Client, error) {
client := &Client{url: rawURL}
if err := client.Dial(); err != nil {
return nil, err
}
if err := client.Connect(); err != nil {
return nil, err
}
return client, nil
}
func (c *Client) Dial() error {