websocket

package
v0.0.244 Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateHandler

func CreateHandler(ws Websocket, config *config.Config) func(*gin.Context)

Types

type Message

type Message struct {
	Type int
	Data []byte
}

type WSHandler

type WSHandler struct {
	// contains filtered or unexported fields
}

type Websocket

type Websocket interface {
	OnMessage(r *http.Request, w Writer, msg []byte, t int, device *models.Device, db *gorm.DB, metrics *metrics.Metrics)
	OnConnect(ctx context.Context, r *http.Request, w Writer, device *models.Device, db *gorm.DB, nats *nats.Conn, metrics *metrics.Metrics, conn *websocket.Conn)
	OnDisconnect(r *http.Request, device *models.Device, db *gorm.DB, metrics *metrics.Metrics)
}

type Writer

type Writer interface {
	WriteMessage(message Message)
	Error(message string)
}

Jump to

Keyboard shortcuts

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