web

package
v5.2.1-release+incompa... Latest Latest
Warning

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

Go to latest
Published: Aug 9, 2020 License: LGPL-3.0 Imports: 27 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Chan

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

Chan handle

type PubContext

type PubContext struct {
	ID string
	// contains filtered or unexported fields
}

PubContext websocket context

func NewPubContext

func NewPubContext(upgrader websocket.Upgrader,
	httpWriter http.ResponseWriter,
	httpRequest *http.Request,
	s *SocketServer,
) *PubContext

NewPubContext create context

func (*PubContext) Close

func (p *PubContext) Close()

Close close the context

func (*PubContext) SendMessage

func (p *PubContext) SendMessage(message WebsocketMessage) error

SendMessage send websocket message

func (*PubContext) SendWebsocketMessage

func (p *PubContext) SendWebsocketMessage(message int) error

SendWebsocketMessage send websocket message

func (*PubContext) Start

func (p *PubContext) Start()

Start start context

func (*PubContext) Stop

func (p *PubContext) Stop()

Stop close context

type ResponseBody

type ResponseBody struct {
	Bean     interface{}   `json:"bean,omitempty"`
	List     []interface{} `json:"list,omitempty"`
	PageNum  int           `json:"pageNumber,omitempty"`
	PageSize int           `json:"pageSize,omitempty"`
	Total    int           `json:"total,omitempty"`
}

ResponseBody 返回主体

type ResponseType

type ResponseType struct {
	Code      int          `json:"code"`
	Message   string       `json:"msg"`
	MessageCN string       `json:"msgcn"`
	Body      ResponseBody `json:"body,omitempty"`
}

ResponseType 返回内容

func NewResponseType

func NewResponseType(code int, message string, messageCN string, bean interface{}, list []interface{}) ResponseType

NewResponseType 构建返回结构

func NewSuccessResponse

func NewSuccessResponse(bean interface{}, list []interface{}) ResponseType

NewSuccessResponse 创建成功返回结构

type SocketServer

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

SocketServer socket 服务

func NewSocket

func NewSocket(conf conf.WebSocketConf, discoverConf conf.DiscoverConf, etcdClient *clientv3.Client, log *logrus.Entry, storeManager store.Manager, c cluster.Cluster, healthInfo map[string]string) *SocketServer

NewSocket 创建zmq sub客户端

func (*SocketServer) ListenError

func (s *SocketServer) ListenError() chan error

ListenError 返回错误通道

func (*SocketServer) Run

func (s *SocketServer) Run() error

Run 执行

func (*SocketServer) Stop

func (s *SocketServer) Stop()

Stop 停止

type WebsocketMessage

type WebsocketMessage struct {
	Event   string      `json:"event"`
	Data    interface{} `json:"data"`
	Channel string      `json:"channel,omitempty"`
}

WebsocketMessage websocket message

func (*WebsocketMessage) Encode

func (w *WebsocketMessage) Encode() []byte

Encode return json encode data

Jump to

Keyboard shortcuts

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