GithubHelp home page GithubHelp logo

gfandada / gserver Goto Github PK

View Code? Open in Web Editor NEW
168.0 13.0 28.0 2.92 MB

通用的实时流golang框架,可以方便的创建游戏服务/聊天服务等

Home Page: https://gfandada.github.io/gserver/

License: Apache License 2.0

Go 100.00%
mmorpg real-time cluster distributed-framework moba game

gserver's Introduction

gserver

This project aims to provide a solution for real-time message flow.
You can create GameServer or others, with gserver.
The communication protocol of GateWay has supported Tcp and Websocket.
DEMO is here. (tcp-gateway and mobagame-service)
LICENSE is here.

Installation

golang version 1.9.2
go get github.com/golang/protobuf/proto
go get github.com/gorilla/websocket
go get github.com/cihub/seelog
go get github.com/koding/multiconfig
go get github.com/garyburd/redigo/redis
go get github.com/HuKeping/rbtree
go get github.com/tealeg/xlsx
go get google.golang.org/grpc
go get github.com/go-sql-driver/mysql

TODO

current version is v0.8.3
next version-v0.9.0 will focus on:
1.optimize safe -- ING
2.optimize microservice
3.add inner logger -- ING
4.add tcp gateway -- DONE
5.add game util package(aoi,space,entity....) -- ING

CONF

更全的配置请查看demo工程
{
	"MaxConnNum": 2048, // 最大连接数:多余的连接将不会响应
	"PendingNum": 100,  // gateway->client异步ipc队列上限
	"MaxMsgLen": 1024,  // client<->gateway message上限:单位byte
	"MinMsgLen": 0,     // client<->gateway message下限:单位byte
	"ReadDeadline":60,  // gateway->client读超时:单位s
	"WriteDeadline":60, // gateway->client写超时:单位s
	"ServerAddress": "localhost:9527", // gateway地址
	"MaxHeader":1024,   // header上限(for websocket):单位byte
	"HttpTimeout": 10,  // http-get超时(for websocket):单位s
	"CertFile": "",     // for ssl
	"KeyFile": "",      // for ssl
	"Rpm":100,          // client->gateway流量上限:每分钟收到的报文数量上限
	"AsyncMQ":64,       // service->gateway异步ipc队列上限
	"GateWayIds":1999   // gateway本地路由id段(当前路由规则是简单的id分段规则)
}

Message

client->gateway
	----------------------------
	| len | seq | id | message |
	----------------------------
	len:seq + id + message,占用2个字节(uint16)
	seq:从1自增的序列号,占用4个字节(uint32)
	id:协议号,占用2个字节(uint16)
	message:业务数据,占用len-6字节,可以使用任意编码:pb/json等,本框架内置了pb2编码器

gateway->client
	----------------------
	| len | id | message |
	----------------------
	len:id + message的长度,占用2个字节(uint16)
	id:协议号,占用两个字节(uint16)
	message:业务数据,占用len-2字节,可以使用任意编码:pb/json等,本框架内置了pb2编码器
	
gateway<->service(base pb3)
	type Data_Frame struct {
		Type    Data_FrameType
		Message []byte
	}

dataflow

image

gserver's People

Contributors

gfandada avatar jekens avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.