anodite-mca
v1.4.4
Published
Anodite-MCA maxed client — resilient WS FCA wrapper with queue, heartbeat, session resume, full method proxy. Config: AndoiteMca.json
Maintainers
Readme
anodite-mca
Maxed-out remote WebSocket FCA client for the Anodite-MCA private multi-session Messenger API server.
Like @hoangquyet/fca — bots talk to your private backend. The FCA engine never ships in this package.
v1.1 — heartbeat, exponential reconnect, request queue, session resume, hooks, batch calls, full method proxy.
Install
npm install anodite-mcaOn first connect(), AndoiteMca.json is created in your project root.
Quick start
const fca = require("anodite-mca");
async function main() {
const api = await fca.connect({ username: "mybot" });
console.log("Logged in as", api.userID);
await api.sendMessage("Hello from Anodite", "THREAD_ID");
api.on("*", (event) => console.log(event.type, event.body));
// or classic:
// api.listenMqtt((err, event) => { ... });
}
main().catch(console.error);Resilience (built-in)
| Feature | Detail |
|---------|--------|
| Heartbeat | Ping every 25s; dead socket → force reconnect |
| Reconnect | Exponential backoff + jitter (3s → max 60s) |
| Session resume | Auto re-login after reconnect when credentials known |
| Request queue | Up to 200 calls buffered offline; flushed after auth |
| Concurrency | Max 32 in-flight RPCs (configurable) |
| Retry | One automatic retry on transient disconnect/timeout |
| Stats | api.getStats() → latency, sent/received, reconnects |
api.on("reconnecting", ({ attempt, delay }) => {});
api.on("reconnected", () => {});
api.on("session_resumed", ({ userID }) => {});
api.on("reconnect_failed", () => {});AndoiteMca.json
{
"username": "mybot",
"key": "",
"autoGenerateKey": true,
"api": {
"url": "https://tetroxide-redwan-production.up.railway.app",
"wsUrl": "wss://tetroxide-redwan-production.up.railway.app/ws",
"masterKey": ""
},
"cookieFile": "./cookie.txt",
"options": { "listenEvents": true, "autoReconnect": true },
"reconnectMs": 3000,
"reconnectMaxMs": 60000,
"autoRelogin": true,
"heartbeatIntervalMs": 25000,
"requestTimeoutMs": 90000,
"maxConcurrent": 32,
"maxQueueSize": 200
}- Empty
key+autoGenerateKey: true→ calls/api/keys/generate?username=and saves the key. connect()options override the file.
API surface
99+ methods proxied to the server, including:
Messaging · reactions · stickers · avatar/bio/cover · groups · threads · typing · presence · upload · posts · stories · themes · E2EE helpers · HTTP utils
Promise or callback:
await api.sendMessage("hi", threadID);
api.sendMessage("hi", threadID, (err, info) => {});Unknown method names are still forwarded dynamically.
Batch
const results = await api.callMany([
{ method: "getUserInfo", args: [uid] },
{ method: "getThreadInfo", args: [tid] },
], { parallel: 8 });Hooks
api.use({
before: async (ctx) => console.log("→", ctx.method),
after: async (ctx) => console.log("←", ctx.method, ctx.durationMs + "ms"),
error: async (ctx) => console.error(ctx.method, ctx.error.message),
});Shutdown
await api.logout(); // server logout + close
api.close(); // local close onlyDefault server
https://tetroxide-redwan-production.up.railway.app
wss://tetroxide-redwan-production.up.railway.app/wsLicense
MIT
