// the find
kone-net/go-chat
go-chat.使用Go基于WebSocket开发的web聊天应用。单聊,群聊。文字,图片,语音,视频消息,屏幕共享,剪切板图片,基于WebRTC的P2P语音通话,视频聊天。
A full-featured Go WebSocket chat server with 1-on-1 and group messaging, plus WebRTC P2P video calls and screen sharing. It's primarily a learning project — the README explicitly says you'll learn channels, Gin, GORM, and protobuf. Production use is an afterthought.
Uses protobuf over WebSocket instead of JSON, which is a solid choice for binary payloads like audio/video frames — the bytes field in the message proto makes file transfer genuinely clean. The Kafka integration for horizontal scaling is architecturally sound: swap a config flag and the single-server channel map becomes a distributed message bus. Go goroutine-per-client model is appropriate for chat and the channel-based client registration/unregistration is textbook correct. Docker Compose deployment with nginx reverse proxy is included and works.
The WebSocket upgrader sets CheckOrigin to always return true — that's a CORS vulnerability that accepts connections from any origin, which matters for a chat app where you're handling user sessions. File storage is local disk, and the README acknowledges this breaks distributed deployments (files land on one node, load balancer sends reader to another). No message persistence on the happy path is visible: messages appear to be forwarded in-memory without writing to MySQL first, so a server restart drops undelivered messages. Authentication passes the user UUID as a plain query string parameter on the WebSocket URL, meaning any sniffed URL is a valid session token.