models

package
v0.0.0-...-5ee4d6d Latest Latest
Warning

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

Go to latest
Published: Jul 31, 2017 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EVENT_JOIN = iota
	EVENT_LEAVE
	EVENT_MESSAGE
	EVENT_BIZ_EXCEPTION
)
View Source
const (
	USER_TYPE_ADMIN   = "admin"
	USER_TYPE_MANAGER = "manager"
	USER_TYPE_USER    = "user"
)

Variables

View Source
var RedisConnPool *redis.Pool

RedisConnPool redis 连接池

Functions

func IsRoomConfigInit

func IsRoomConfigInit(room int, redisConn redis.Conn)

IsRoomConfigInit 检查房间配置是否初始化,否则初始化

func SetRoomMaxOnline

func SetRoomMaxOnline(room int, redisConn redis.Conn)

SetRoomMaxOnline 更新聊天室最大在线人数

func Subscribe

func Subscribe(room int) redis.PubSubConn

Subscribe 订阅基于redis的房间消息

func UnSubscribe

func UnSubscribe(psc redis.PubSubConn)

UnSubscribe 连接断开,取消订阅

Types

type Event

type Event struct {
	Type      EventType // JOIN, LEAVE, MESSAGE
	ClientId  string
	Timestamp int // Unix timestamp (secs)
	Content   string
	Room      int
}

type EventType

type EventType int

type User

type User struct {
	ID       int    //用户ID
	Type     string //用户类型 admin,manager,user
	Username string //用户昵称
}

User 用户信息

Jump to

Keyboard shortcuts

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