ws

package
v1.3.8 Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2021 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DeployFail      = 0
	RepoFollow      = 1
	AfterPullScript = 2
	Rsync           = 3
	DeploySuccess   = 4
)
View Source
const (
	TypeProject = 1
	TypeMonitor = 3
)
View Source
const (
	MonitorTurnOff = 0
)

Variables

This section is empty.

Functions

func Init

func Init()

Init websocket

Types

type Client

type Client struct {
	Conn     *websocket.Conn
	UserInfo model.User
}

Client stores a client information

type Data

type Data struct {
	Type    int
	UserIDs []int64
	Message Message
}

Data is message struct

type Hub

type Hub struct {

	// Inbound messages from the clients.
	Data chan *Data

	// Register requests from the clients.
	Register chan *Client

	// Unregister requests from clients.
	Unregister chan *Client
	// contains filtered or unexported fields
}

Hub is a client struct

func GetHub

func GetHub() *Hub

GetHub it will only init once in main.go

func (*Hub) Connect

func (hub *Hub) Connect(gp *core.Goploy) *core.Response

Connect the publish information in websocket

func (*Hub) Sftp added in v1.3.3

func (hub *Hub) Sftp(gp *core.Goploy) *core.Response

Sftp the server file information in websocket

func (*Hub) Xterm added in v1.2.1

func (hub *Hub) Xterm(gp *core.Goploy) *core.Response

Xterm the publish information in websocket

type Message

type Message interface {
	// contains filtered or unexported methods
}

type MonitorMessage added in v1.0.3

type MonitorMessage struct {
	MonitorID    int64  `json:"monitorId"`
	State        uint8  `json:"state"`
	ErrorContent string `json:"errorContent"`
}

ProjectMessage is publish project message struct

type ProjectMessage

type ProjectMessage struct {
	ProjectID   int64       `json:"projectId"`
	ProjectName string      `json:"projectName"`
	State       uint8       `json:"state"`
	Message     string      `json:"message"`
	Ext         interface{} `json:"ext"`
}

ProjectMessage is publish project message struct

Jump to

Keyboard shortcuts

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