Skip to content

Commit

Permalink
新增Connect方法
Browse files Browse the repository at this point in the history
  • Loading branch information
steden committed Sep 4, 2024
1 parent 475279b commit 6441c83
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions ws/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,16 @@ func NewClient(addr string, msgBufferSize int) (*Client, error) {
return client, nil
}

// Connect 连接
func Connect(addr string, msgBufferSize int) (*Client, error) {
client, err := NewClient(addr, msgBufferSize)
if err != nil {
return client, err
}
err = client.Connect()
return client, err
}

// SetHeader 设置header
func (receiver *Client) SetHeader(key, value string) {
receiver.config.Header.Set(key, value)
Expand Down

0 comments on commit 6441c83

Please sign in to comment.