ws

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Dec 3, 2021 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Broadcast

func Broadcast(data []byte, filter *Filter) error

func BroadcastBinary

func BroadcastBinary(data []byte, filter *Filter) error

func Init

func Init(ctx contextx.Context, r *gin.RouterGroup, opfs ...func(opt Options))

func OnConnect

func OnConnect(fn func(*melody.Session))

func OnDisConnect

func OnDisConnect(fn func(*melody.Session))

func OnMessage

func OnMessage(fn func(session *melody.Session, bytes []byte))

func OnMessageBinary

func OnMessageBinary(fn func(session *melody.Session, bytes []byte))

Types

type Filter

type Filter struct {
	Keys map[string]map[interface{}]struct{}
	// contains filtered or unexported fields
}

func NewBlacklistFilter

func NewBlacklistFilter(key string, vals ...interface{}) *Filter

func NewWhitelistFilter

func NewWhitelistFilter(key string, vals ...interface{}) *Filter

func (*Filter) AddKeys

func (f *Filter) AddKeys(key string, vals ...interface{})

type Options

type Options interface {
	SetCallTimeout(t time.Duration)
	SetRelativePath(relativePath string)
	SetKeys(keys ...string)
	SetAuth(auth func(c *gin.Context))
}

Jump to

Keyboard shortcuts

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