Proyek
Lihat di GitHub
ethan-well/go-chat
Tentang
Program obrolan berkonkurensi tinggi dalam Go / ruang obrolan Go
Produktivitas dan otomatisasiPertumbuhan bintang terukur
- dalam 24 jam
- 0
- dalam 7 hari
- 0
- dalam 15 hari
- 0
- dalam 1 bulan
- Mengumpulkan riwayat
Perubahan bersih pada periode yang tumpang tindih, bukan total harian. Pengukuran yang belum tersedia dibiarkan kosong. Bintang menunjukkan perhatian, bukan kualitas.
README.md
Asli项目简介
这是使用 Golang 网络编程实现的一个多人在线聊天系统,使用 goroutine 达到高并发的效果,使用 redis 来保存用户的注册信息。 项目目录结构如下:
.
├── README.md
├── client // 客户端代码
│ ├── logger // 自定义的日志打印器
│ │ └── logger.go
│ ├── main.go // 主函数
│ ├── model // model 层
│ │ └── user.go
│ ├── process // 处理与服务器端的连接,收发消息
│ │ ├── messageProcess.go
│ │ ├── serverProcess.go
│ │ └── userProcess.go
│ └── utils
│ └── utils.go
├── common // 客户端和服务端公用代码,主要用来定义客户端和服务端之间通信约定的消息
│ └── message
│ └── message.go
├── config // 配置信息
│ ├── config.go
│ └── config.json
└── server // 服务端代码
├── main // 主函数
│ ├── main.go
│ └── redis.go
├── model // model 层
│ ├── clientConn.go
│ ├── error.go
│ ├── user.go
│ └── userDao.go
├── process // 处理与客户端的连接,收发消息
│ ├── groupMessageProcess.go // 处理群消息
│ ├── onlineInfoProcess.go // 显示在线用户
│ ├── pointToPointMessageProcess.go // 处理点对点聊天消息
│ ├── processor.go // 消息处理器入口
│ └── userProcess.go // 处理和用户登陆注册相关消息
└── utils
└── utils.go
服务端和客户端代码基本独立,server 目录下是服务端代码,client 目录下是客户端代码,common 目录下的包由服务端和客户端共同使用
本地运行本项目(Unix 系统下)
下载项目
下载到本地的 GOPATH 目录下(后面会提供 go get 的方式以方便使用),由于这是 Golang 项目,所以需要你本地有 Golang 的运行环境
cd ${GOPATH}/src
git clone [email protected]:ItsWewin/go-chat.git
编译和运行
编译并运行服务端代码
go build -o server gochat/server/main
./server
编译并运行客户端代码
go build -o client gochat/client
./client
这样就大功告成,你就可以在本地体验本项目了。
项目概况
项目目前实现了如下功能
- 用户注册、登陆
- 显示所有在线用户列表
- 发送群消息(目前是发送给在线的所有用户)
- 私聊某一个用户
- 按照消息的类型(info, notice, warn, error, success) 使用不同的颜色打印消息(Unix 和 window 均支持)
项目效果图
注册

登陆

显示在线用户列表

群聊

私聊

English
chat room
The chat room developed by Golang, It's a good project to learn Golang and Golang netWork developemt
usage
clone this project to your GOPATH
cd ${GOPATH}/src
git clone [email protected]:ItsWewin/go-chat.git
build server and run it
go build -o server gochat/server/main
./server
build client and run it
go build -o client gochat/client
./client
Function of this demo
- User register
- User login
- User send group message
- Show online user list
- Point-to-point communication
Jelajahi proyek terkait
Memuat…