controller

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Sep 3, 2021 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateChannel

func CreateChannel(c *gin.Context)

CreateChannel controller

func CreateClient

func CreateClient(c *gin.Context)

CreateClient controller

func CreateConfig

func CreateConfig(c *gin.Context)

CreateConfig controller

func DeleteChannelByName

func DeleteChannelByName(c *gin.Context)

DeleteChannelByName controller

func DeleteClientByID

func DeleteClientByID(c *gin.Context)

DeleteClientByID controller

func DeleteConfigByKey

func DeleteConfigByKey(c *gin.Context)

DeleteConfigByKey controller

func GetChannelByName

func GetChannelByName(c *gin.Context)

GetChannelByName controller

func GetClientByID

func GetClientByID(c *gin.Context)

GetClientByID controller

func GetConfigByKey

func GetConfigByKey(c *gin.Context)

GetConfigByKey controller

func Health

func Health(c *gin.Context)

Health controller

func Home

func Home(c *gin.Context)

Home controller

func Metrics

func Metrics() http.Handler

Metrics controller

func Subscribe

func Subscribe(c *gin.Context)

Subscribe controller

func Unsubscribe

func Unsubscribe(c *gin.Context)

Unsubscribe controller

func UpdateChannelByName

func UpdateChannelByName(c *gin.Context)

UpdateChannelByName controller

func UpdateConfigByKey

func UpdateConfigByKey(c *gin.Context)

UpdateConfigByKey controller

Types

type BroadcastRequest

type BroadcastRequest struct {
	Channels []string `json:"channels"`
	Data     string   `json:"data"`
}

BroadcastRequest struct

func (*BroadcastRequest) ConvertToJSON

func (c *BroadcastRequest) ConvertToJSON() (string, error)

ConvertToJSON converts object to json

func (*BroadcastRequest) LoadFromJSON

func (c *BroadcastRequest) LoadFromJSON(data []byte) (bool, error)

LoadFromJSON load object from json

type Message

type Message struct {
	FromClient string `json:"from_client"`
	ToClient   string `json:"to_client"`
	Channel    string `json:"channel"`
	Data       string `json:"data"`
}

Message struct

func (*Message) IsValid

func (m *Message) IsValid() bool

IsValid checks if message is valid

type PublishRequest

type PublishRequest struct {
	Channel string `json:"channel"`
	Data    string `json:"data"`
}

PublishRequest struct

func (*PublishRequest) ConvertToJSON

func (c *PublishRequest) ConvertToJSON() (string, error)

ConvertToJSON converts object to json

func (*PublishRequest) LoadFromJSON

func (c *PublishRequest) LoadFromJSON(data []byte) (bool, error)

LoadFromJSON load object from json

type Websocket

type Websocket struct {
	Clients   util.Map
	Broadcast chan Message
	Upgrader  websocket.Upgrader
}

Websocket Object

func (*Websocket) BroadcastAction

func (e *Websocket) BroadcastAction(c *gin.Context, rawBody []byte)

BroadcastAction controller

func (*Websocket) HandleConnections

func (e *Websocket) HandleConnections(w http.ResponseWriter, r *http.Request, ID string, token string)

HandleConnections manage new clients

func (*Websocket) HandleMessages

func (e *Websocket) HandleMessages()

HandleMessages send messages to a specific connected client

func (*Websocket) Init

func (e *Websocket) Init()

Init initialize the websocket object

func (*Websocket) PublishAction

func (e *Websocket) PublishAction(c *gin.Context, rawBody []byte)

PublishAction controller

Jump to

Keyboard shortcuts

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