How taoshihan1991/goflylivechat works
GOFLY LIVE CHAT is a customer-support chat service: visitors connect through the embedded chat or live-chat page, exchange real-time messages with support agents, and agents manage conversations and customer-service settings. The repository exposes HTTP routes and WebSocket handlers, with models backed by the documented MySQL database. The map also preserves documented installation, administration, and frontend capabilities. Source excerpts show routing and selected WebSocket/model interactions; many controller and frontend details are unsampled, so their internal links are omitted.
Main entry points: router HTTP routes · chat-widget.js Embedded chat widget · cmd Server and install commands · visitor.go Visitor WebSocket
Components 22
Service entry
- Application entry
main.go - Server and install commands
cmd - HTTP routes
router - Request middleware
middleware - Database installation
controller/main.go
Live chat
- Visitor WebSocket
ws/visitor.go - Agent WebSocket
ws/user.go - WebSocket runtime
ws/ws.go - Message endpoints
controller/message.go - Visitor endpoints
controller/visitor.go - Message records
models/messages.go - Visitor records
models/visitors.go
Support operations
- Agent accounts
controller/kefu.go - Support settings and roles
controller - Automatic replies
controller/reply.go
Web client
- Embedded chat widget
static/js/chat-widget.js - Chat client functions
static/js/functions.js - Layui UI library
static/css/layui/layui.js - Layer dialogs
static/js/layer/layer.js - Icon font
static/css/icon/iconfont.js
Other components
- Visitor or agent
- MySQL
Connections 22
- Visitor or agent → Embedded chat widget: opens chat
- Embedded chat widget → Visitor WebSocket: connects to
- Visitor or agent → HTTP routes: uses service
router/api.go - Application entry → Server and install commands: executes
main.go - Server and install commands → HTTP routes: registers routes
cmd/server.go - Server and install commands → Request middleware: installs middleware
cmd/server.go - Server and install commands → WebSocket runtime: starts backend
cmd/server.go - HTTP routes → Visitor WebSocket: routes visitor socket
router/api.go - HTTP routes → Agent WebSocket: routes agent socket
router/api.go - HTTP routes → Message endpoints: routes messages
router/api.go - HTTP routes → Visitor endpoints: routes visitors
router/api.go - HTTP routes → Agent accounts: routes agent actions
router/api.go - Visitor WebSocket → Visitor records: loads visitor
ws/visitor.go - Visitor WebSocket → Message records: loads last message
ws/visitor.go - Database installation → MySQL: checks connection
controller/main.go - Database installation → Visitor records: uses models
controller/main.go - Database installation → WebSocket runtime: counts clients
controller/main.go - Message records → MySQL: persists records
- Visitor records → MySQL: persists records
- Chat client functions → Embedded chat widget: supports client
- Embedded chat widget → Layui UI library: uses UI library
- Embedded chat widget → Layer dialogs: uses dialogs