Documentation ¶
Index ¶
- Variables
- func NewConnHandle(con *net.TCPConn) wellConnInterface
- type ConnRouter
- type Group
- func (this *Group) AddGroup(GroupName string, Con WellConnection)
- func (this *Group) DelGroup(GroupName string)
- func (this *Group) DelGroupConn(GroupName string, ConnId int64)
- func (this *Group) GetAllGroup() []string
- func (this *Group) GetAllGroupCon(GroupName string) []WellConnection
- func (this *Group) SendToGroup(GroupName string, Data string)
- type LinkManger
- type ServerRouter
- type WellConnRouter
- type WellConnection
- type WellMessage
- type WellMessageInterface
- type WellRequest
- type WellServer
- type WellServerInterface
- type WellServerRouter
Constants ¶
This section is empty.
Variables ¶
View Source
var Logo = `` /* 790-byte string literal not displayed */
Functions ¶
func NewConnHandle ¶
Types ¶
type ConnRouter ¶
type ConnRouter struct { }
TODO 连接路由类
func (*ConnRouter) OnClose ¶
func (this *ConnRouter) OnClose(conn *WellConnection)
func (*ConnRouter) OnConnect ¶
func (this *ConnRouter) OnConnect(conn *WellConnection)
func (*ConnRouter) OnError ¶
func (this *ConnRouter) OnError(err error)
func (*ConnRouter) OnMessage ¶
func (this *ConnRouter) OnMessage(request *WellRequest)
type Group ¶
type Group struct { }
func (*Group) AddGroup ¶
func (this *Group) AddGroup(GroupName string, Con WellConnection)
将连接对象添加到某个组中
func (*Group) DelGroupConn ¶
移除某个组中的某个连接(并不会关掉连接)
func (*Group) GetAllGroupCon ¶
func (this *Group) GetAllGroupCon(GroupName string) []WellConnection
获取指定分组的所有连接
func (*Group) SendToGroup ¶
向某个组的所有成员发送信息
type LinkManger ¶
type LinkManger struct { }
func (*LinkManger) GetAllLink ¶
func (this *LinkManger) GetAllLink() map[int64]*WellConnection
func (*LinkManger) GetLink ¶
func (this *LinkManger) GetLink(Id int64) *WellConnection
func (*LinkManger) SendToAll ¶
func (this *LinkManger) SendToAll(Data string)
func (*LinkManger) SendToId ¶
func (this *LinkManger) SendToId(Id int64, Data string)
type ServerRouter ¶
type ServerRouter struct { }
TODO 服务路由类
func (*ServerRouter) OnClose ¶
func (this *ServerRouter) OnClose()
func (*ServerRouter) OnStart ¶
func (this *ServerRouter) OnStart()
type WellConnRouter ¶
type WellConnRouter interface { OnConnect(conn *WellConnection) OnError(err error) OnMessage(request *WellRequest) OnClose(conn *WellConnection) }
方法
type WellConnection ¶
type WellConnection struct { ConnId int64 IpAddr string Port string LinkManger Group // contains filtered or unexported fields }
func (*WellConnection) Close ¶
func (this *WellConnection) Close()
func (*WellConnection) Start ¶
func (this *WellConnection) Start()
func (*WellConnection) WriteByte ¶
func (this *WellConnection) WriteByte(Data []byte)
func (*WellConnection) WriteString ¶
func (this *WellConnection) WriteString(Data string)
type WellMessage ¶
信息
type WellMessageInterface ¶
type WellServer ¶
type WellServer struct { Name string IpAddr string Port string ServerRouter WellServerRouter ConnRouter WellConnRouter IpVersion string Version string LinkManger Group // contains filtered or unexported fields }
func (*WellServer) AddConnRouter ¶
func (this *WellServer) AddConnRouter(c WellConnRouter)
func (*WellServer) AddServerRouter ¶
func (this *WellServer) AddServerRouter(s WellServerRouter)
func (*WellServer) Close ¶
func (this *WellServer) Close()
func (*WellServer) Groups ¶ added in v1.1.10
func (this *WellServer) Groups() *Group
func (*WellServer) Links ¶ added in v1.1.10
func (this *WellServer) Links() *LinkManger
func (*WellServer) Run ¶
func (this *WellServer) Run()
type WellServerInterface ¶ added in v1.2.1
type WellServerInterface interface { Run() AddServerRouter(s WellServerRouter) AddConnRouter(c WellConnRouter) Close() Groups() *Group Links() *LinkManger }
type WellServerRouter ¶
type WellServerRouter interface { OnStart() OnClose() }
Click to show internal directories.
Click to hide internal directories.