websocket_plugin

package
v1.4.4 Latest Latest
Warning

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

Go to latest
Published: Jan 26, 2022 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Session added in v1.3.6

type Session struct {
	*websocket.Conn
	HttpSession *http.Request
	Context     context.Context
	// contains filtered or unexported fields
}

func (*Session) Get added in v1.3.6

func (s *Session) Get(key string) (interface{}, bool)

func (*Session) Set added in v1.3.6

func (s *Session) Set(key string, value interface{})

type WebsocketConfig added in v1.3.6

type WebsocketConfig struct {
	types.AutoConfigure `prefix:"websocket"`
	WriteWait           time.Duration `yaml:"write_wait"`         // Time allowed to write a message to the peer.
	MaxMessageSize      int64         `yaml:"max_message_size"`   // Maximum message size allowed from peer.
	PongWait            time.Duration `yaml:"pong_wait"`          // Time allowed to read the next pong message from the peer.
	PingPeriod          time.Duration `yaml:"ping_period"`        // Send pings to peer with this period. Must be less than pongWait.
	CloseGracePeriod    time.Duration `yaml:"close_grace_period"` // Time to wait before force close on connection.
	CheckOrigin         bool          `yaml:"check_origin"`
}

WebsocketConfig is websocket config

type WebsocketController

type WebsocketController struct {
	types.Component

	Config *WebsocketConfig
	// contains filtered or unexported fields
}

WebsocketController is decorate dynamic controller

func (*WebsocketController) Bean

func (w *WebsocketController) Bean() string

func (*WebsocketController) Channel

func (w *WebsocketController) Channel(r *http.Request, rw http.ResponseWriter)

func (*WebsocketController) Group added in v1.4.2

func (w *WebsocketController) Group() string

type WebsocketHandler

type WebsocketHandler interface {
	bean.Bean
	Endpoint() string
	OnOpen(session *Session)
	OnClose(session *Session)
	OnMessage(session *Session, message []byte) error
	OnError(session *Session, err error)
}

WebsocketHandler bean define

type WebsocketStarter

type WebsocketStarter struct {
	types.Component
	Handlers []WebsocketHandler `wire:""`
	Log      log.Logger         `wire:""`
}

func NewStarter added in v1.3.6

func NewStarter() *WebsocketStarter

func (*WebsocketStarter) Init added in v1.4.4

func (w *WebsocketStarter) Init() error

Jump to

Keyboard shortcuts

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