qxchat.ts is optimized for high-performance selfbot applications. To achieve maximum throughput with near-zero latency, it runs exclusively on the Bun runtime.
Warning
Strict Runtime Restriction: This SDK contains a hard runtime environment lock. Any attempt to import or execute it outside of Bun (e.g. under Node.js or in a standard browser environment) will immediately throw a fatal initialization error.
- Zero Dependency Footprint: Light lockfile, zero third-party packages. We run entirely on Bun's built-in APIs.
- Compile-Time Constraints: Username character constraints, message length bounds, and file sizes are enforced while you type via TypeScript branding.
- Direct E2EE Integration: Fully integrated AES-GCM encryption with room ID as additional authenticated data (AAD). Message payloads are automatically encrypted/decrypted transparently.
bun add qxchat.tsRequirements: Bun ≥ 1.1.0 and TypeScript 5.x
This library is designed for low overhead and near-zero latency. Below are the execution benchmarks conducted natively under Bun (tested using a real connection to the QXChat production server):
Last Benchmarked: July 11, 2026
| Benchmark | Type | Metric / Operations | Duration (ms) |
|---|---|---|---|
| REST Auth Token Fetch | HTTP REST | Get session token | ~315.7 ms |
| Gateway WS Connect & Identify | WebSocket | Established and ready | ~533.1 ms |
| REST Profile Self-Fetch | HTTP REST | Refresh user session /me |
~205.6 ms |
| Gateway Room Join | WebSocket | Join room by token | ~0.33 ms |
| RTT E2EE Message (Send & Echo) | WebSocket / Crypto | local encrypt ➔ send ➔ server echo ➔ receive ➔ local decrypt | ~263.6 ms |
| AES-GCM Encryption (CPU Local) | Cryptography | 10,000 local encryptions | ~1002.3 ms (0.100 ms/op) |
Tip
Key Caching & Native DNS Pre-warming: Thanks to Web Crypto key caching and native Bun DNS prefetching, the room joining takes under 0.4 ms and the E2EE messaging RTT is under 200 ms.
import { SelfbotClient, MessageBuilder, Events } from 'qxchat.ts';
const client = new SelfbotClient();
client.on(Events.Ready, async () => {
console.log(`Connected as ${client.username}!`);
const roomToken = '3f9ade207e2c5dbf58f1c91533ecac7b1dc5ba6066cc07951f9c5fcc5d9fa98c';
await client.joinRoom(roomToken);
const roomId = roomToken.slice(0, 32);
const msg = new MessageBuilder('Hello from Snayz!')
.setAttachment('qxchat.txt', 'Hello from QXChat.ts team!', 'text/plain');
await client.sendMessage(roomId, msg);
});
client.on(Events.MessageCreate, (msg) => {
if (msg.username !== client.username) {
console.log(`[${msg.username}]: ${msg.text}`);
msg.reply('ALLO?');
}
});
const token = await SelfbotClient.fetchToken('user', 'pass');
await client.login(token);bun install # install dependencies
bun test # run tests
bun run typecheck # run TypeScript type checksNote: The tests, JSDocs, and code comments in this repository were generated by an AI and subsequently reviewed and reworked by a human.