ws

package
v1.9.0 Latest Latest
Warning

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

Go to latest
Published: Jun 10, 2021 License: GPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddReadCallback

func AddReadCallback(msgType string, callback interface{})

func BroadcastAll

func BroadcastAll(data string)

func BroadcastTopic

func BroadcastTopic(topic string, data string)

func HandlerFunc

func HandlerFunc(context echo.Context) error

func Init

func Init() error

func NewAlert

func NewAlert(level string, title string, message string) (string, error)

func Subscribe

func Subscribe(s *melody.Session, topic string)

func Unsubscribe

func Unsubscribe(s *melody.Session, topic string)

func UnsubscribeAll

func UnsubscribeAll(s *melody.Session)

Types

type WebsocketAlert

type WebsocketAlert struct {
	Level   string `json:"level"`
	Title   string `json:"title"`
	Message string `json:"msg"`
}

type WebsocketMessage

type WebsocketMessage struct {
	Type string      `json:"type"`
	Data interface{} `json:"data"`
}

func (WebsocketMessage) ToJsonString

func (whMessage WebsocketMessage) ToJsonString() (string, error)

Jump to

Keyboard shortcuts

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