Compare commits
2 Commits
a4a015a4cc
...
b38c6b0a54
Author | SHA1 | Date | |
---|---|---|---|
b38c6b0a54 | |||
ce8f58ed2d |
1
go.mod
1
go.mod
@ -4,7 +4,6 @@ go 1.19
|
||||
|
||||
require (
|
||||
github.com/google/go-querystring v1.1.0
|
||||
github.com/mitchellh/mapstructure v1.5.0
|
||||
github.com/recws-org/recws v1.4.0
|
||||
)
|
||||
|
||||
|
2
go.sum
2
go.sum
@ -6,8 +6,6 @@ github.com/gorilla/websocket v1.4.2 h1:+/TMaTYc4QFitKJxsQ7Yye35DkWvkdLcvGKqM+x0U
|
||||
github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
|
||||
github.com/jpillora/backoff v1.0.0 h1:uvFg412JmmHBHw7iwprIxkPMI+sGQ4kzOWsMeHnm2EA=
|
||||
github.com/jpillora/backoff v1.0.0/go.mod h1:J/6gKK9jxlEcS3zixgDgUAsiuZ7yrSoa/FX5e0EB2j4=
|
||||
github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY=
|
||||
github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo=
|
||||
github.com/recws-org/recws v1.4.0 h1:y9LLddtAicjejikNZXiaY9DQjIwcAQ82acd1XU6n0lU=
|
||||
github.com/recws-org/recws v1.4.0/go.mod h1:7+NQkTmBdU98VSzkzq9/P7+X0xExioUVBx9OeRKQIkk=
|
||||
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
|
13
websocket.go
13
websocket.go
@ -59,6 +59,19 @@ func NewWebSocket(baseURL string) (*WSClient, error) {
|
||||
return out, nil
|
||||
}
|
||||
|
||||
// SetConnectHandler sets the connection handler function
|
||||
func (c *WSClient) SetConnectHandler(f func() error) {
|
||||
c.conn.SubscribeHandler = f
|
||||
}
|
||||
|
||||
// ConnectHandler invokes the connection handler function
|
||||
func (c *WSClient) ConnectHandler() error {
|
||||
if c.conn.SubscribeHandler == nil {
|
||||
return nil
|
||||
}
|
||||
return c.conn.SubscribeHandler()
|
||||
}
|
||||
|
||||
func (c *WSClient) Login(ctx context.Context, l types.Login) error {
|
||||
u := &url.URL{}
|
||||
*u = *c.baseURL
|
||||
|
Loading…
Reference in New Issue
Block a user