Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CancelFunc ¶
type CancelFunc func()
CancelFunc is the interface that provides a method to cancel a listener.
type Connect ¶
type Connect struct { // Started holds the time when the connection attempt was started. Started time.Time // At holds the time when the connection was made/errored out. At time.Time // Mode is the IP mode used to connect. Mode IPMode // RetryingAt is the time when the next connection attempt will be made. RetryingAt time.Time // Error is the error returned from the attempt to connect. Err error }
type ConnectListener ¶
type ConnectListener interface {
OnConnect(Connect)
}
ConnectListener is the interface that must be implemented by types that want to receive Connect notifications.
type ConnectListenerFunc ¶
type ConnectListenerFunc func(Connect)
ConnectListenerFunc is a function type that implements ConnectListener. It can be used as an adapter for functions that need to implement the ConnectListener interface.
func (ConnectListenerFunc) OnConnect ¶
func (f ConnectListenerFunc) OnConnect(c Connect)
type Disconnect ¶
type Disconnect struct { // At holds the time when the connection was closed. At time.Time // Error is the error returned from the disconnection. Err error }
Disconnect is the event that is sent when the connection is closed.
type DisconnectListener ¶
type DisconnectListener interface {
OnDisconnect(Disconnect)
}
DisconnectListener is the interface that must be implemented by types that want to receive Disconnect notifications.
type DisconnectListenerFunc ¶
type DisconnectListenerFunc func(Disconnect)
DisconnectListenerFunc is a function type that implements DisconnectListener. It can be used as an adapter for functions that need to implement the DisconnectListener interface.
func (DisconnectListenerFunc) OnDisconnect ¶
func (f DisconnectListenerFunc) OnDisconnect(d Disconnect)
type Heartbeat ¶
type Heartbeat struct { // At holds the time when the heartbeat occurred. At time.Time // Type is the type of heartbeat that occurred. Type HeartbeatType }
Heartbeat is the event that is sent when the heartbeat PING is received and the PONG is sent.
type HeartbeatListener ¶
type HeartbeatListener interface {
OnHeartbeat(Heartbeat)
}
HeartbeatListener is the interface that must be implemented by types that want to receive Heartbeat notifications.
type HeartbeatListenerFunc ¶
type HeartbeatListenerFunc func(Heartbeat)
HeartbeatListenerFunc is a function type that implements HeartbeatListener. It can be used as an adapter for functions that need to implement the HeartbeatListener interface.
func (HeartbeatListenerFunc) OnHeartbeat ¶
func (f HeartbeatListenerFunc) OnHeartbeat(h Heartbeat)
type HeartbeatType ¶
type HeartbeatType int
HeartbeatType is the type of heartbeat that occurred.
const ( PING HeartbeatType = iota PONG )
type MsgListener ¶
type MsgListener interface {
OnMessage(wrp.Message)
}
MsgListener is the interface that must be implemented by types that want to receive wrp.Message notifications from the websocket.
type MsgListenerFunc ¶
type MsgListenerFunc func(wrp.Message)
MsgListenerFunc is a function type that implements MsgListener. It can be used as an adapter for functions that need to implement the MsgListener interface.
func (MsgListenerFunc) OnMessage ¶
func (f MsgListenerFunc) OnMessage(m wrp.Message)