Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func WebsocketServer ¶ added in v0.9.0
func WebsocketServer(opts ...WsServerOption) register.RegisterOption
Types ¶
type BroadcastInput ¶ added in v0.9.0
type BroadcastOutput ¶ added in v0.9.0
type BroadcastOutput struct { Type MessageType `json:"type"` Value string `json:"value"` Msg []byte `json:"msg"` }
type MessageBox ¶ added in v0.9.0
type MessageBox struct { Title struct { SysMsg int `json:"sys_msg"` Source string `json:"source"` Target string `json:"target"` } `json:"title"` Body string `json:"body"` }
前端约定的消息实体
type MessageType ¶ added in v0.9.0
type MessageType string
var ( MessageAll MessageType = "all" // 全局消息 MessageGroup MessageType = "room" // 房间消息 MessageClient MessageType = "client" // 单点客户端消息 MessageSys MessageType = "sys" // 系统消息 )
type WsServer ¶ added in v0.9.0
type WsServer struct { WriteWait time.Duration `toml:"write_wait"` PongWait time.Duration `toml:"pong_wait"` PingPeriod time.Duration `toml:"ping_period"` MaxMessageSize int64 `toml:"max_message_size"` ReadBufferSize int64 `toml:"read_buffer_size"` WriteBufferSize int64 `toml:"write_buffer_size"` MaxMsgChannelSize int64 `toml:"max_msg_channel_size"` // contains filtered or unexported fields }
var (
WsSvc *WsServer
)
type WsServerOption ¶ added in v0.9.0
type WsServerOption func(*WsServer)
func SetWsConfig ¶ added in v0.9.0
func SetWsConfig(cfgs ...Config) WsServerOption
func SetWsName ¶ added in v0.9.0
func SetWsName(name string) WsServerOption
Click to show internal directories.
Click to hide internal directories.