websocket

package
v2.3.200 Latest Latest
Warning

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

Go to latest
Published: Jul 29, 2025 License: MIT Imports: 15 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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