百科.dev
全部条目在线工具AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
Z

zinx

> 编程语言
开源

基于 Golang 的轻量级并发服务器框架。

7.7K stars0 点赞2 次浏览
访问官网GitHub

工具介绍

基于 Golang 的轻量级并发服务器框架。

English | 简体中文 Zinx is a lightweight concurrent server framework based on Golang.

Document

< Zinx Wiki : English >

< Zinx 文档 : 简体中文>

Note: Zinx has been widely used in many enterprises for development purposes, including message forwarding for backend modules, long-linked game servers, and message handling plugins for web frameworks. Zinx is positioned as a framework with concise code that allows developers to quickly understand the internal details of the framework and easily customize it based on their own enterprise scenarios.


Source of Zinx

platform Entry
Github https://github.com/aceld/zinx
Gitcode https://gitcode.com/aceld/zinx
Gitee https://gitee.com/Aceld/zinx

Website

http://zinx.me


Online Tutorial

platform Entry
Zinx Framework tutorial-Lightweight server based on Golang
《Golang轻量级并发服务器框架zinx》

Online Tutorial Video

platform online video

I. One word that has been said before

Why did we create Zinx? Although there are many Golang application frameworks for servers, there are few lightweight enterprise frameworks applied in the gaming or other long-linked fields.

The purpose of designing Zinx is to provide a complete outline of how to write a TCP server based on Golang, so that more Golang enthusiasts can learn and understand this field in a straightforward manner.

The development of the Zinx framework project is synchronized with the creation of learning tutorials, and all the incremental and iterative thinking involved in the development process is incorporated into the tutorials. This approach avoids overwhelming beginners with a complete framework that they may find difficult to grasp all at once.

The tutorials will be iterated version by version, with each version adding small increments of functionality, allowing a beginner to gradually and comprehensively learn about the field of server frameworks.

Of course, we hope that more people will join Zinx and provide us with valuable feedback, enabling Zinx to become a truly enterprise-level server framework. Thank you for your attention!

II. Zinx architecture

III. Zinx development API documentation

(1) QuickStart

<Zinx's TCP Debugging Tool>

DownLoad zinx Source

bash
$go get github.com/aceld/zinx

note: Golang Version 1.17+

Zinx-Server

go
package main

import (
	"fmt"
	"github.com/aceld/zinx/ziface"
	"github.com/aceld/zinx/znet"
)

// PingRouter MsgId=1 
type PingRouter struct {
	znet.BaseRouter
}

//Ping Handle MsgId=1
func (r *PingRouter) Handle(request ziface.IRequest) {
	//read client data
	fmt.Println("recv from client : msgId=", request.GetMsgID(), ", data=", string(request.GetData()))
}

func main() {
	//1 Create a server service
	s := znet.NewServer()

	//2 configure routing
	s.AddRouter(1, &PingRouter{})

	//3 start service
	s.Serve()
}

Run Server

bash
$ go run server.go
…

Zinx-Client

…

Run Client

bash
$ go run client.go 
2023/03/09 19:04:54 [INFO]client.go:73: [START] Zinx Client LocalAddr: 127.0.0.1:55294, RemoteAddr: 127.0.0.1:8999
2023/03/09 19:04:54 [INFO]connection.go:354: ZINX CallOnConnStart....

Terminal of Zinx Print:

bash
recv from client : msgId= 1 , data= Ping...Ping...Ping...[FromClient]
recv from client : msgId= 1 , data= Ping...Ping...Ping...[FromClient]
recv from client : msgId= 1 , data= Ping...Ping...Ping...[FromClient]
recv from client : msgId= 1 , data= Ping...Ping...Ping...[FromClient]
recv from client : msgId= 1 , data= Ping...Ping...Ping...[FromClient]
recv from client : msgId= 1 , data= Ping...Ping...Ping...[FromClient]
...

(2) Zinx configuration file

json
{
  "Name":"zinx v-0.10 demoApp",
  "Host":"0.0.0.0",
  "TCPPort":9090,
  "MaxConn":3,
  "WorkerPoolSize":10,
  "LogDir": "./mylog",
  "LogFile":"app.log",
  "LogSaveDays":15,
  "LogCons": true,
  "LogIsolationLevel":0
}

Name:Server Application Name

Host:Server IP

TcpPort:Server listening port

MaxConn:Maximum number of client links allowed

WorkerPoolSize:Maximum number of working Goroutines in the work task pool

LogDir: Log folder

LogFile: Log file name (if not provided, log information is printed to Stderr)

LogIsolationLevel: Log Isolation Level -0: Full On 1: Off debug 2: Off debug/info 3: Off debug/info/warn


Developers

Zinx Authors
zinx 刘丹冰(@aceld) 张超(@zhngcho) 高智辉Roger(@adsian) 胡贵建(@huguijian) 张继瑀(@kstwoak) 夏小力(@xxl6097) 李志成(@clukboy)姚承政(@hcraM41)李国杰(@LI-GUOJIE)余喆宁(@YanHeDoki)
moke-kit(Microservices) GStones(@GStones)
zinx(C++) 刘洋(@marklion)
zinx(Lua) 胡琪(@huqitt)
ginx(Java) ModuleCode(@ModuleCode)

Thanks to all the developers who contributed to Zinx!


About the author

name:Aceld(刘丹冰)

mail: [email protected]

github: https://github.com/aceld

original work: https://www.yuque.com/aceld

Join the Zinx community

platform Entry
https://discord.gg/xQ8Xxfyfcz
加微信: ace_ld 或扫二维码,备注zinx即可。
WeChat Public Account
QQ Group

Issues· 96 开放

查看全部 Issues在 GitHub 打开
  • #407

    关于使用 SendBuffMsg 后,QPS 明显下降,并且存在『僵死』连接的问题

    更新于 2026年6月6日
  • #406

    example/zinx_decoder/bin/main.go 是否写错了?

    更新于 2026年5月12日
  • #120

    路由器增强建议

    help wanted更新于 2026年5月11日
  • #248

    建议在handler中增加context参数,放在第一位

    更新于 2026年5月11日
  • #284

    请问zinx 是否必须通过 msgid 处理消息?

    更新于 2026年5月11日
  • #400

    在链接关闭时有可能发生 panic

    更新于 2026年5月11日
  • #394

    在 ws 连接时,如何绑定参数

    更新于 2026年5月4日
  • #395

    阻塞

    更新于 2026年3月9日
  • #396

    还是时间 hip99..9'-%/@好

    更新于 2026年2月14日
  • #392

    在客户端模式下,使用自定义解码器以及路由时,发现进入解码器的消息顺序和进入路由处理器的顺序不一致

    更新于 2025年11月14日

> 标签

Gogame-servergogolangtcp-server

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年10月1日
分类编程语言
定价开源

> 相关工具

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言