Ginx is a lightweight Go game-server framework with length-prefixed messages, message-ID routing, per-connection read/write goroutines, configurable worker pools, connection lifecycle hooks, and graceful shutdown.
Run commands from the repository root so config/ginx.json is loaded:
go run ./main/serverThe example server registers message IDs 0 and 1. Run the matching clients in separate terminals:
go run ./main/client0
go run ./main/client1A complete tutorial example is available in main/tutorial:
go run ./main/tutorial/server
go run ./main/tutorial/clientRun the server and client in separate terminals. The client sends a ping and a heartbeat message every two seconds.
Run the automated checks with:
go test ./...
go vet ./...
go build ./...See the game server guide for the message protocol, router setup, concurrency notes, and current production boundaries.
Ginx 是一个轻量级 Go 游戏服务端框架,提供长度前缀消息协议、按消息 ID 路由、单连接读写协程、可配置 Worker 工作池、连接生命周期钩子和优雅停服。
请在项目根目录运行以下命令,确保能加载 config/ginx.json:
go run ./main/server示例服务注册了消息 ID 0 和 1。请在两个独立终端中运行对应客户端:
go run ./main/client0
go run ./main/client1完整教程示例位于 main/tutorial 目录:
go run ./main/tutorial/server
go run ./main/tutorial/client请在两个独立终端中运行服务端和客户端。客户端每两秒发送一次 ping 消息和心跳消息。
运行自动化测试、静态检查和构建验证:
go test ./...
go vet ./...
go build ./...消息协议、路由注册、并发注意事项和当前生产使用边界,请参阅游戏服务端使用指南。