ws

package
v0.0.0-...-65deff2 Latest Latest
Warning

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

Go to latest
Published: May 20, 2023 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	WRITE_WAIT    = 10 * time.Second
	PONG_WAIT     = 60 * time.Second
	PING_INTERVAL = (PONG_WAIT * 9) / 10
	READ_LIMIT    = 512
)

Variables

View Source
var (
	NEWLINE = []byte{'\n'}
	SPACE   = []byte{' '}
)

Functions

func WebsocketHandler

func WebsocketHandler(ctx *gin.Context, dispatcher Dispatcher)

Types

type Client

type Client struct {
	ID     string
	Header http.Header
	// contains filtered or unexported fields
}

func (*Client) CloseQueue

func (c *Client) CloseQueue()

func (*Client) Send

func (c *Client) Send(message []byte)

type Dispatcher

type Dispatcher interface {
	CheckOrigin(r *http.Request) bool
	Packet(packet *Packet)
	Register(client *Client, params gin.Params)
	Subprotocols() []string
	Unregister(client *Client)
}

type Packet

type Packet struct {
	Client  *Client
	Message []byte
}

Jump to

Keyboard shortcuts

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