Documentation
¶
Index ¶
Constants ¶
View Source
const ( DEFAULT_WRITER_BUFFER_SIZE = 10 DEFAULT_RETRY_TIME = 3 )
Variables ¶
This section is empty.
Functions ¶
func ServeWSClientConnection ¶
func ServeWSClientConnection(ctx *WSClientContext, h handler.WSClientHandler)
func TryConnect ¶
func TryConnect(ctx *WSClientContext, config *WSClientConfig) error
func TrySendCloseClosure ¶
func TrySendCloseClosure(ctx *WSClientContext) error
Types ¶
type WSAddr ¶
func ResolveWSAddrFromSocket ¶
type WSClientConfig ¶
type WSClientConfig struct {
HostAddr net.Addr
RequestHeader http.Header
LogConfigs logger.LogConfigs
WriterBufferSize int
}
func NewWSClientConfig ¶
func NewWSClientConfig() (c *WSClientConfig, err error)
type WSClientContext ¶
type WSClientContext struct {
// CID is the uuid for each wscontext
CID string
/*
websocket connection related fields
*/
// embeded context
context.Context
Cancel context.CancelFunc
// context level logger
Logger *logrus.Logger
// contains filtered or unexported fields
}
func NewWSClientContext ¶
func NewWSClientContext(config *WSClientConfig) (*WSClientContext, error)
NewWSClientContext will try to create context with relevant websocket connection
func (*WSClientContext) IsActive ¶
func (ctx *WSClientContext) IsActive() bool
Click to show internal directories.
Click to hide internal directories.