handlers

package
v0.0.0-...-2942fcd Latest Latest
Warning

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

Go to latest
Published: Dec 27, 2017 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Connection

func Connection(ws *websocket.Conn)

func Send

func Send(uid string, msg *structs.Message)

直接发送消息给对于用户

Types

type ConnectingPool

type ConnectingPool struct {
	Users     map[string]*OnlineUser
	Broadcast chan structs.Message
	CloseSign chan bool
}

上线用户的连接池

func GetConnectingPool

func GetConnectingPool() *ConnectingPool

将连接池开放给其他包访问

type OnlineUser

type OnlineUser struct {
	Connection *websocket.Conn
	Send       chan structs.Message
	UserInfo   *structs.UserInfo
}

上线用户结构

func (*OnlineUser) PullFromClient

func (this *OnlineUser) PullFromClient()

等待客户端消息

func (*OnlineUser) PushToCline

func (this *OnlineUser) PushToCline()

将Send队列消息推送出去

func (*OnlineUser) UserOnlineNotice

func (onlineUser *OnlineUser) UserOnlineNotice()

通知相应的用户,本用户上线消息

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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