websocketService

package
v0.0.0-...-d539b93 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 20, 2023 License: Apache-2.0 Imports: 13 Imported by: 0

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

type WSAddr struct {
	net.Addr
	Api string
}

func ResolveWSAddrFromSocket

func ResolveWSAddrFromSocket(socket, api string) (addr *WSAddr, err error)

func (*WSAddr) Network

func (addr *WSAddr) Network() string

func (*WSAddr) String

func (addr *WSAddr) String() string

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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL