How tinode/chat works
Tinode is a Go instant-messaging server with JSON/WebSocket, long-polling and gRPC client access, plus a Python command-line client and chatbot example. The main workflow is a client connection and session dispatch into messaging, presence and call handling, backed by persistence and optional integrations. The README documents broad chat capabilities, but the sampled excerpts do not expose all topic-level routing; the graph preserves those domain areas without guessing their internal call sequence.
Main entry points: store.go Persistence facade · session.go Sessions and dispatch · auth.go Authentication framework · client.py CLI gRPC client
Components 27
Messaging server
- Server startup
server/main.go - Connection transports
server/hdl_websock.go - gRPC transport
server/hdl_grpc.go - Sessions and dispatch
server/session.go - Topics and chat
server/topic.go - Voice and video calls
server/calls.go - Presence and delivery
server/pres.go - Protocol model
pbx/model.proto
Persistence
- Persistence facade
server/store/store.go - MySQL adapter
server/db/mysql/adapter.go - PostgreSQL adapter
server/db/postgres/adapter.go - RethinkDB adapter
server/db/rethinkdb/adapter.go - MongoDB adapter
server/db/mongodb/adapter.go
Auth and integrations
- Authentication framework
server/auth/auth.go - Basic authentication
server/auth/basic/auth_basic.go - REST authentication
server/auth/rest/auth_rest.go - Media storage
server/media/media.go - S3 media backend
server/media/s3/s3.go - Push notifications
server/push/push.go - Push payload model
server/push/common/typedef.go
Client tools
- CLI input handling
tn-cli/input_handler.py - CLI gRPC client
tn-cli/client.py - CLI commands
tn-cli/commands.py - Chatbot example
chatbot/python/chatbot.py - Python gRPC bindings
py_grpc/tinode_grpc/__init__.py
Other components
- Messaging user
- Mobile and web clients
Connections 23
- Messaging user → Mobile and web clients: uses
README.md - Mobile and web clients → Connection transports: connects via WebSocket
README.md - Mobile and web clients → gRPC transport: connects via gRPC
README.md - Connection transports → Sessions and dispatch: dispatches
- gRPC transport → Sessions and dispatch: dispatches
- Server startup → Authentication framework: initializes
server/main.go - Server startup → Media storage: configures
server/main.go - Sessions and dispatch → Authentication framework: uses
server/session.go - Sessions and dispatch → Persistence facade: uses
server/session.go - Sessions and dispatch → Protocol model: handles messages
server/session.go - Persistence facade → MySQL adapter: adapts persistence
server/db/mysql/adapter.go - Persistence facade → PostgreSQL adapter: adapts persistence
server/db/postgres/adapter.go - Persistence facade → RethinkDB adapter: adapts persistence
server/db/rethinkdb/adapter.go - Persistence facade → MongoDB adapter: adapts persistence
- Basic authentication → Authentication framework: registers scheme
server/auth/basic/auth_basic.go - REST authentication → Authentication framework: registers scheme
server/auth/rest/auth_rest.go - REST authentication → Messaging user: calls external auth
server/auth/rest/auth_rest.go - S3 media backend → Media storage: implements backend
server/media/s3/s3.go - Push notifications → Push payload model: uses payload types
server/push/push.go - CLI input handling → CLI gRPC client: feeds input
tn-cli/client.py - CLI gRPC client → CLI commands: uses commands
tn-cli/client.py - CLI gRPC client → Python gRPC bindings: uses bindings
tn-cli/client.py - Chatbot example → Python gRPC bindings: uses bindings
chatbot/python/chatbot.py