1. 项目地址:

    # leaf 官网
    https://github.com/name5566/leaf
    # 基于 leaf 的 go module 版本
    https://github.com/job520/leaf.git
  2. leaf 使用介绍:

    1. 编辑 msg/msg.go 定义消息格式
    2. 编辑 gate/router.go 将消息格式路由到指定模块
    3. 编辑 {模块名}/internal/handler.go 注册处理函数
  3. demo 用法:

    1. 下载项目:
      git clone https://github.com/job520/leaf.git
      cd leaf
    2. 开启服务器:
      go run main.go
    3. 使用 websocket 客户端:
      用浏览器打开 index.html 文件
    4. 使用 tcp 客户端:
      go run client.go
文档更新时间: 2024-04-20 10:57   作者:lee