process2

package
v0.0.0-...-2bf1368 Latest Latest
Warning

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

Go to latest
Published: Aug 25, 2020 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type SmsProcess

type SmsProcess struct {
}

func (*SmsProcess) SendGroupMes

func (this *SmsProcess) SendGroupMes(mes *message.Message)

写方法转发消息

func (*SmsProcess) SendMesToEachOnlineUser

func (this *SmsProcess) SendMesToEachOnlineUser(data []byte, conn net.Conn)

type UserMgr

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

func (*UserMgr) AddOnlineUser

func (this *UserMgr) AddOnlineUser(up *UserProcess)

完成对onlineUsers添加

func (*UserMgr) DelOnlineUser

func (this *UserMgr) DelOnlineUser(userId int)

删除

func (*UserMgr) GetAllOnlineUser

func (this *UserMgr) GetAllOnlineUser() map[int]*UserProcess

返回当前所有在线的用户

func (*UserMgr) GetOnlineUserById

func (this *UserMgr) GetOnlineUserById(userId int) (up *UserProcess, err error)

根据id返回对应的值

type UserProcess

type UserProcess struct {
	//字段
	Conn net.Conn
	//增加一个字段,表示该Conn是哪个用户
	UserId int
}

func (*UserProcess) NotifyMeOnline

func (this *UserProcess) NotifyMeOnline(userId int)

func (*UserProcess) NotifyOthersOnlineUser

func (this *UserProcess) NotifyOthersOnlineUser(userId int)

这里我们编写通知所有在线的用户的方法 userId 要通知其它的在线用户,我上线

func (*UserProcess) ServerProcessLogin

func (this *UserProcess) ServerProcessLogin(mes *message.Message) (err error)

编写一个函数serverProcessLogin函数, 专门处理登录请求

func (*UserProcess) ServerProcessRegister

func (this *UserProcess) ServerProcessRegister(mes *message.Message) (err error)

Jump to

Keyboard shortcuts

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