Getting Started
AfterLink v2.0.2 is a high-performance application-layer binary protocol engineered for persistent, real-time node communication across Node.js, Python, and Dart. Learn how to configure persistent server and client connections with built-in speed, priority queues, and clustering.
Why AfterLink?
- ● Protocol v2 16-Byte Header: Fixed 16-byte header with version negotiation (v1/v2), 8 priority queues (0-7), and custom string routing keys (0-255 bytes).
- ● 76% Faster than WebSockets: Streamlined binary framing reduces TCP wire transmission latencies to a bare minimum.
- ● Node Clustering & Redis Pub/Sub: High-availability worker management via
@ajaymyth/clusterwith crash detection, SIGUSR2 rolling restarts, and Redis Cluster slot routing. - ● Multi-Language SDKs: First-class Python (
afterlinkon PyPI) and Dart/Flutter (afterlinkon pub.dev) SDKs with native TCP and WebSocket transports. - ● Built-in Observability: Self-contained Prometheus metrics endpoint, Grafana dashboard JSON template, and OpenTelemetry-compliant
TracingManagerwith AsyncLocalStorage context propagation.
Prerequisites
Ensure your local environment matches the requirements before starting implementation:
- Node.js version
v18.0.0or higher (v20+ recommended) - Python 3.8+ (if using the Python SDK)
- Dart 3.0+ / Flutter 3.0+ (if using the Dart SDK)
- npm, pnpm, or yarn package manager
Installation
Install the standard AfterLink scoped packages from the npm registry:
Quick Start — Server
Create a server script in your project root to handle binary framing:
Quick Start — Client
Establish a persistent connection from your client and publish your first frame:
Node Clustering
Scale AfterLink across multi-core systems using @ajaymyth/cluster. Includes Redis-backed shared pub/sub routing, worker crash detection/restarts, and zero-downtime SIGUSR2 rolling restarts:
Python SDK
AfterLink provides a native Python SDK (pip install afterlink) featuring async client/server APIs, synchronous wrappers, full type hints, and Pydantic schema validation:
Dart & Flutter SDK
Connect Dart and Flutter apps seamlessly using the afterlink package on pub.dev. Supports native TCP sockets on desktop/mobile and WebSocket fallback on web via conditional compilation:
Metrics & Observability
Monitor server performance using built-in Prometheus endpoints, Grafana dashboard JSON templates, and OpenTelemetry-compliant TracingManager context propagation across binary frames: