Documentation ¶
Index ¶
- Constants
- func NewClientWithReconnect(opt *Option)
- type Client
- type Connections
- type Option
- func (o *Option) Cancel()
- func (o *Option) ChangeStatus(s OptionStatus)
- func (o *Option) Done() <-chan struct{}
- func (o *Option) Next() bool
- func (o *Option) Prepare() error
- func (o *Option) Read() <-chan []byte
- func (o *Option) RegisterFunc(do ...OptionRegisterFunction)
- func (o *Option) Send(in []byte) error
- func (o *Option) SetMaxRetryCount(in int64)
- type OptionMaintainType
- type OptionRegisterFunction
- type OptionStatus
Constants ¶
View Source
const ( ConnectionTimeoutInSec = 10 WriteToChannelTimeoutInMS = 1000 RetryConnectionDurationInMS = 3000 )
View Source
const (
ConnectionTimeout = 10
)
Variables ¶
This section is empty.
Functions ¶
func NewClientWithReconnect ¶
func NewClientWithReconnect(opt *Option)
Types ¶
type Client ¶
type Connections ¶
type Connections struct {
// contains filtered or unexported fields
}
func NewConnections ¶
func NewConnections(ctx context.Context) *Connections
func (*Connections) Handler ¶
func (cs *Connections) Handler(w http.ResponseWriter, r *http.Request, handler handler.Interface)
func (*Connections) SendToAll ¶
func (cs *Connections) SendToAll(data []byte)
type Option ¶
type Option struct { Dialer *websocket.Dialer Url url.URL Status OptionStatus Maintain OptionMaintainType MaxRetryCount int64 // RetryDuration was the wait time in Millisecond RetryDuration int64 // contains filtered or unexported fields }
func (*Option) ChangeStatus ¶
func (o *Option) ChangeStatus(s OptionStatus)
func (*Option) RegisterFunc ¶
func (o *Option) RegisterFunc(do ...OptionRegisterFunction)
func (*Option) SetMaxRetryCount ¶
type OptionMaintainType ¶
type OptionMaintainType string
const ( OptionMaintainOnce OptionMaintainType = "once" OptionMaintainRetry OptionMaintainType = "retry" )
type OptionRegisterFunction ¶
type OptionRegisterFunction func() error
type OptionStatus ¶
type OptionStatus string
const ( OptionActive OptionStatus = "active" OptionInActive OptionStatus = "inactive" OptionClosed OptionStatus = "closed" )
Click to show internal directories.
Click to hide internal directories.