websocket_plugin

package
v1.3.6 Latest Latest
Warning

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

Go to latest
Published: Aug 19, 2021 License: Apache-2.0 Imports: 10 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 Starter added in v1.3.6

type Starter struct {
	bean.Component
	Handlers []WebsocketHandler
}

func NewStarter added in v1.3.6

func NewStarter() *Starter

func (*Starter) AfterInit added in v1.3.6

func (w *Starter) AfterInit()

type WebsocketConfig added in v1.3.6

type WebsocketConfig struct {
	bean.Component
	// Time allowed to write a message to the peer.
	WriteWait time.Duration `yaml:"write_wait"`

	// Maximum message size allowed from peer.
	MaxMessageSize int64 `yaml:"max_message_size"`

	// Time allowed to read the next pong message from the peer.
	PongWait time.Duration `yaml:"pong_wait"`

	// Send pings to peer with this period. Must be less than pongWait.
	PingPeriod time.Duration `yaml:"ping_period"`

	// Time to wait before force close on connection.
	CloseGracePeriod time.Duration `yaml:"close_grace_period"`

	CheckOrigin bool `yaml:"check_origin"`
}

WebsocketConfig is websocket config

func (*WebsocketConfig) Prefix added in v1.3.6

func (w *WebsocketConfig) Prefix() string

type WebsocketController

type WebsocketController struct {
	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) Controller

func (w *WebsocketController) Controller() 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

Jump to

Keyboard shortcuts

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