Formal definitions of WireChat's JSON payload protocol, SQLite database tables, and customizable configuration properties.
A detailed mapping of every packet type sent back and forth between client and server.
Clients must authenticate before sending chat messages or performing commands.
{
"type": "login",
"username": "alice",
"password": "secret"
}
{
"type": "auth_success",
"username": "alice"
}
Used for client messaging inside channels and private Direct Messages (DMs).
{
"type": "message",
"content": "Hello tech room!"
}
{
"type": "message",
"username": "alice",
"room": "tech",
"content": "Hello tech room!",
"timestamp": 1715901243100
}
Emitted in response to command queries like `/rooms` or `/history`.
{
"type": "rooms_list",
"rooms": [
{
"name": "general",
"description": "General",
"users": 4
}
]
}
{
"type": "history",
"messages": [
{
"username": "alice",
"room": "tech",
"content": "Hey there",
"timestamp": 1715901243000
}
]
}
Structure of the database tables created automatically in chat.db.
-- Table: users (Stores user account credentials)
CREATE TABLE IF NOT EXISTS users (
username TEXT PRIMARY KEY,
password TEXT -- Argon2id secure hash
);
-- Table: messages (Stores chat room histories)
CREATE TABLE IF NOT EXISTS messages (
id INTEGER PRIMARY KEY AUTOINCREMENT,
room TEXT,
sender TEXT,
content TEXT,
timestamp INTEGER -- Unix Epoch milliseconds
);
WireChat utilizes a centralized configuration file at shared/config.js. Modify settings there to adjust network, database, validation rules, or default limits globally.
| Setting / Variable | config.js Key | Description |
|---|---|---|
Port |
network.port |
Sets the listening port for the WebSocket server and the target port for TUI clients (default: 5051). |
Host |
network.host |
Sets the listening address and connection target host (default: 127.0.0.1). |
Database Path |
database.filename |
The SQLite filename located in the root of the project workspace (default: chat.db). |
Default Room |
defaults.defaultRoom |
The auto-joined chat room upon successful login (default: general). |
History Limit |
defaults.historyLimit |
The default message count returned by /history (default: 50). |
Validation Constraints |
validation |
Globally configures username limits (min/max length) and message character bounds (default: 500 chars). |