websocket

package
v2.3.192 Latest Latest
Warning

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

Go to latest
Published: Jul 21, 2025 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	NewClientListenerType   = "new-Client"
	CloseClientListenerType = "close-Client"
	NewMessageListenerType  = "new-message"
)

Variables

View Source
var (
	MaxMessageSize int64 = 512
)

Functions

This section is empty.

Types

type Client

type Client struct {
	ID int
	// contains filtered or unexported fields
}

type Listener

type Listener struct {
	Event    string
	Message  []byte
	ClientID int
}

type Message

type Message struct {
	Type        string      `json:"type"`
	Action      string      `json:"action"`
	Message     interface{} `json:"message"`
	From        *int        `json:"from,omitempty"`
	To          []int       `json:"to,omitempty"`
	ContentType int         `json:"-"`
}

type WebSocket

type WebSocket interface {
	InitHandler(api *gin.RouterGroup)
	SendMessage(ctx context.Context, m Message) error
	RegisterClientListener() <-chan Listener
	ShutDown()
}

func New

func New(lenChan int) WebSocket

Jump to

Keyboard shortcuts

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