models

package
v0.0.0 Latest Latest
Warning

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

Go to latest
Published: Oct 3, 2019 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BaseModel

type BaseModel struct {
}

type Config

type Config struct {
	BaseModel
	Params        map[string]interface{}                   // 参数。自定义的配置参数
	ComponentDict map[string]base.ConfigComponentInterface // 组件。组件名 => 配置
}

配置实例。用于封装配置

func (*Config) Init

func (config *Config) Init()

初始化数据

type Message

type Message struct {
	BaseModel
	Id    int64  `json:"i"` // 协议号
	Route string `json:"r"` // 路由
	Data  string `json:"d"` // 传输的数据
}

func (*Message) Validate

func (model *Message) Validate() bool

验证数据是否合法

type Response

type Response struct {
}

type WebsocketSession

type WebsocketSession struct {
	BaseModel
	// contains filtered or unexported fields
}

websocket 使用的 session 。没有发送的功能。必须依赖 WebsocketServer 进行发送

func NewWebsocketSession

func NewWebsocketSession(conn *websocket.Conn) *WebsocketSession

新建websocket session

func (*WebsocketSession) Close

func (model *WebsocketSession) Close() error

关闭连接

func (*WebsocketSession) GetSendMessage

func (model *WebsocketSession) GetSendMessage() []byte

获取发送消息

func (*WebsocketSession) RemoveAddr

func (model *WebsocketSession) RemoveAddr() net.Addr

获取远端地址

func (*WebsocketSession) Send

func (model *WebsocketSession) Send(message []byte)

发送消息

Jump to

Keyboard shortcuts

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