bbgo_origin/websocket/interface.go
2020-06-09 10:38:20 +08:00

22 lines
369 B
Go

package websocket
import (
"context"
"time"
)
//go:generate mockery -name=Client
type Client interface {
SetWriteTimeout(time.Duration)
SetReadTimeout(time.Duration)
OnConnect(func(c Client))
OnDisconnect(func(c Client))
Connect(context.Context) error
Reconnect()
Close() error
IsConnected() bool
WriteJSON(interface{}) error
Messages() <-chan Message
}