websocket

package
v2.3.143 Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2025 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

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

Variables

This section is empty.

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"`
}

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