Micro Socket Documentation
A microservice-like paradigm for real-time communication at global scale.
This documentation covers the Micro Socket methodology end to end: paradigm, sub-socket model, invariants, detailed algorithms, flowcharts, and Node.js code examples.
⭐ Star on GitHub — If this doc is useful, star the repo.
Quick Links
| Section | Description |
|---|---|
| Methodology | What Micro Socket is, principles, global solutions |
| Sub-Socket Model | Server/client sub-sockets, millions of broadcasts |
| Invariants | I₁–I₇: ACL, dedup, ordering, delivery, SLO, resume, integrity |
| Algorithms | Master flow, pseudocode, Mermaid diagrams |
| Elysia Example | Full gateway (Bun): sub-sockets, broadcast, millions scale |
| Price Feed Gateway | Main socket (raw Binance prices) + channels with per-symbol margins |
| Node.js Gateway | WebSocket gateway, ACL, dedup, NATS/Redis |
| Node.js Client | SDK, seqNo, ACK, RESUME |
| Full E2E Example | Working sample project |
| Test & Fintech | Test matrix, metrics, fintech scenarios |
Micro Socket Summary
- Server: One sub-socket per topic; scalable to millions of subscriptions.
- Client: Same idea with multiple micro sockets (e.g. price / risk / payment channels).
- Guarantees: No unauthorized access (I₁), no double processing (I₂), ordered delivery (I₃), delivery (I₄), latency SLO (I₅), resume (I₆), integrity (I₇).
Use the sidebar to navigate. Flowcharts use Mermaid; Node.js examples can be copied into your project.