How ss-dev/fb-chat-emulator works
fb-chat-emulator is a lightweight Facebook-chat API stand-in for load-testing chatbot applications. A chatbot sends requests to the emulator; it applies configured timing, matches request rules, and may send templated responses back to the chatbot. Operators can inspect or reset live statistics. The graph follows the documented workflow and sampled handlers; the sample config represents the configuration format, not the runtime config file itself.
Main entry points: main.go HTTP server · chat.go Request processing · stat.go Stat update channel · config.go Load config
Components 15
Emulator runtime
- HTTP server
main.go - Load config
config.go - Request handler
main.go - Stats and reset handlers
main.go
Rule processing
- Request processing
chat.go - Rule matching
chat.go - Build and send response
chat.go
Statistics
- Stat update channel
stat.go - Stat accumulator
stat.go - Reset statistics
stat.go - Render statistics
stat.go
Other components
- Chatbot app
- Operator browser
- Rule config
config.sample.json - Configured chatbot endpoint
Connections 19
- Rule config → Load config: configures
- HTTP server → Load config: loads
- HTTP server → Stat accumulator: starts
- Chatbot app → HTTP server: sends requests
- HTTP server → Request handler: dispatches
- Request handler → Request processing: calls
- Request processing → Rule matching: matches rules
- Rule matching → Stat update channel: records unmatched
- Request processing → Stat update channel: records no-response
- Request processing → Build and send response: starts asynchronously
- Build and send response → Stat update channel: records results
- Build and send response → Configured chatbot endpoint: posts response
- Stat update channel → Stat accumulator: delivers updates
- Operator browser → HTTP server: requests stats
- HTTP server → Stats and reset handlers: dispatches
- Stats and reset handlers → Reset statistics: resets on request
- Stats and reset handlers → Render statistics: renders table
- Reset statistics → Render statistics: renders table
- Stat accumulator → Render statistics: provides totals