Skip to content

Commit

Permalink
Update
Browse files Browse the repository at this point in the history
  • Loading branch information
f0cii committed May 6, 2020
1 parent 0c0ef3b commit 485d8e7
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions parameter.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ type WsParameter struct {
ReqHeaders map[string][]string
Dialer *websocket.Dialer
MessageHandleFunc func([]byte) error
ReSubscribeFunc func() error // 短线重连后触发,你可以重新订阅,因为有些订阅跟当前时间相关
ReSubscribeFunc func(ws *WsConn) error // 短线重连后触发,你可以重新订阅,因为有些订阅跟当前时间相关
ErrorHandleFunc func(err error)
AutoReconnect bool // 自动重连(默认: true)
ReSubscribe bool // 自动重新订阅(默认: true)
Expand Down Expand Up @@ -62,7 +62,7 @@ func WsMessageHandleFuncOption(f func([]byte) error) WsParameterOption {
}
}

func WsReSubscribeFuncOption(f func() error) WsParameterOption {
func WsReSubscribeFuncOption(f func(ws *WsConn) error) WsParameterOption {
return func(p *WsParameter) {
p.ReSubscribeFunc = f
}
Expand Down
2 changes: 1 addition & 1 deletion websocket.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ func (ws *WsConn) reconnect() {
}
}
if ws.ReSubscribeFunc != nil {
err = ws.ReSubscribeFunc()
err = ws.ReSubscribeFunc(ws)
if err != nil {
log.Printf("[ws] websocket re-subscribe fail, %s", err.Error())
}
Expand Down

0 comments on commit 485d8e7

Please sign in to comment.