skeleton

package module
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2022 License: Apache-2.0 Imports: 12 Imported by: 0

README

skeleton

An framework for using Tcp Server and Tcp Client Our goal is make an easy tools to use tcp socket.

目前主要用于实现游戏的服务端部分

通讯协议

Quick Tutorial

Problem

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	RouteHandler = NewServiceRegister()
)

Functions

func ConnectServer

func ConnectServer(addr string, clientConn proto.ClientConnection) error

func Router

func Router(pattern string, si interface{}, method string)

func StartServer

func StartServer(addr string, connListener proto.Connection, tcpServer *TcpServer) error

Types

type BaseRouter

type BaseRouter interface {
	InitContext(ctx *Context)
}

type Context

type Context struct {
	SessionUniqueKey string
	// contains filtered or unexported fields
}

func NewContext

func NewContext(otherId int64) *Context

func (*Context) AddDelayRequest

func (this *Context) AddDelayRequest(request *models.PushRequest, delay time.Duration)

func (*Context) AddPushRequest

func (this *Context) AddPushRequest(request *models.PushRequest)

func (*Context) GetUserId

func (this *Context) GetUserId() int64

func (*Context) SendPushRequest

func (this *Context) SendPushRequest()

func (*Context) SetPushFunc

func (this *Context) SetPushFunc(pushFunc func(*models.PushRequest))

func (*Context) SetUserId

func (this *Context) SetUserId(otherId int64)

type ServiceRegister

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

func NewServiceRegister

func NewServiceRegister() *ServiceRegister

type TcpServer

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

func NewTcpServer

func NewTcpServer() *TcpServer

func (*TcpServer) DeleteSession

func (this *TcpServer) DeleteSession(uniqueKey string)

func (*TcpServer) GetSession

func (this *TcpServer) GetSession(uniqueKey string) *proto.TcpSession

func (*TcpServer) GetUniqueKeys

func (this *TcpServer) GetUniqueKeys() []string

func (*TcpServer) PutSession

func (this *TcpServer) PutSession(uniqueKey string, session *proto.TcpSession)

func (*TcpServer) SessionCount

func (this *TcpServer) SessionCount() int

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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