The high-level TCP library Python never had — sync, thread-friendly, zero dependencies
Project description
Veltix
The high-level TCP library Python never had.
Sync, thread-friendly, zero dependencies : TCP done right.
Veltix handles framing, threading, handshake, routing, and reconnection
so you can focus on your application logic.
77k msg/s • 0.032ms latency • 46KB idle • 2x stress throughput • 100% success rate
Table of Contents
- Why Veltix
- Features
- Performance
- Installation
- Quick Start
- Integrated Logger
- Request/Response Pattern
- Built-in Ping/Pong
- Advanced Features
- Comparison
- Roadmap
- Migration Guide
- Examples
- Security
- Contributing
- License
Built with Veltix
Projects using Veltix in production:
- Nexo : Fast LAN file transfer tool CLI + GUI.
Uses Veltix's TCP server, client tags, route decorators, and
send_and_wait()for reliable chunked file transfers with concurrent connection handling.
Built something with Veltix ? Open a PR or start a discussion to add your project.
Why Veltix
Python's socket module is powerful but painful. You end up reimplementing
framing, threading, reconnection, and protocol design every single time.
Heavier alternatives like asyncio or Twisted solve this but force you into
async/await or steep learning curves.
Veltix sits in between:
- No async required : sync, thread-based, works like you expect
- No boilerplate : framing, handshake, routing, reconnect are built-in
- No dependencies : pure Python stdlib, zero install friction
- FastAPI-style routing :
@server.route(MY_TYPE)instead ofif/elifchains
# This is all you need to get a working server
@server.route(CHAT)
def on_chat(response: Response, client: ClientInfo):
print(f"{client.addr}: {response.content.decode()}")
Designed for: LAN tools, multiplayer games, real-time dashboards, custom protocols, IPC, remote tooling, file transfer.
Features
Core
- Zero dependencies : pure Python stdlib
- Binary protocol with CRC32 integrity verification
- Automatic HELLO/HELLO_ACK handshake with version compatibility
- Thread-safe callback execution : slow handlers never block reception
API
- FastAPI-style routing :
@server.route(MY_TYPE)/@client.route(MY_TYPE) send_and_wait(): built-in request/response correlation with timeout- Built-in ping/pong : bidirectional latency measurement
- Client tags : attach arbitrary metadata to connected clients
Reliability
- Auto-reconnect : configurable retry with
DisconnectStatecallbacks SMALL/MEDIUM/LARGEbuffer size presets- Swappable socket backends via
SocketCore(Threading or Async/Selectors, Rust in v3.0.0)
Developer Experience
- Integrated logger : colorized, file-rotating, thread-safe
- 261 tests, CI on Python 3.8 / 3.10 / 3.12 / 3.14
Performance
Benchmarked on Python 3.14.5 — 12-core CPU, 30.5 GB RAM, Linux (loopback).
| Metric | Threading | Async |
|---|---|---|
| Concurrent stress (100 clients) | 37,676 msg/s | 76,929 msg/s |
| Burst throughput | 52,109 / 41,327 | 52,296 / 41,343 |
| Average latency | 0.032 ms | 0.035 ms |
| Idle server memory | 46 KB | 4 KB |
| Per client memory (avg) | 36 KB | 12 KB |
| FPS simulation (64 players @ 64Hz) | 4,488 msg/s | 4,488 msg/s |
Full benchmark details, methodology, and how to run them yourself : PERFORMANCE.md
Installation
pip install veltix
Requirements: Python 3.8+, no additional dependencies.
Quick Start
Server:
from veltix import Server, ServerConfig, ClientInfo, Response, MessageType, Request, Events
CHAT = MessageType(code=200, name="chat")
server = Server(ServerConfig(host="0.0.0.0", port=8080))
sender = server.get_sender()
def on_message(client: ClientInfo, response: Response):
print(f"[{client.addr[0]}] {response.content.decode()}")
sender.broadcast(Request(CHAT, response.content), server.get_all_clients_sockets())
server.set_callback(Events.ON_RECV, on_message)
server.start()
input("Press Enter to stop...")
server.close_all()
Client:
from veltix import Client, ClientConfig, Response, MessageType, Request, Events
CHAT = MessageType(code=200, name="chat")
client = Client(ClientConfig(server_addr="127.0.0.1", port=8080))
client.set_callback(Events.ON_RECV, lambda r: print(f"Server: {r.content.decode()}"))
client.connect()
client.get_sender().send(Request(CHAT, b"Hello Server!"))
input("Press Enter to disconnect...")
client.disconnect()
python server.py
python client.py # In a separate terminal
Roadmap
v1.6.6 : Version Compatibility & Reconnect Stability (May 2026) : Released
Version class, reconnect stability fixes, +111 tests, CI on Python 3.8-3.14
v1.6.8 : Architecture Refactor (May 2026) : Released
ClientContext Protocol, Rules system for RequestHandler, README rewrite
v1.6.9 : Reconnect Stability & Cleanup (June 2026) : Released
8 bug fixes across reconnect path + code quality cleanups
v1.7.0 : AsyncSocket + Protocol Hardening (June 2026) : Released
AsyncSocket (selectors), MAGIC bytes, corruption recovery, benchmark averaging.
2x stress throughput, memory cut by 40-74%.
Comparison
| Feature | Veltix | socket |
asyncio |
Twisted |
|---|---|---|---|---|
| Simple API | ✓ | ✗ | ~ | ✗ |
| Zero dependencies | ✓ | ✓ | ✓ | ✗ |
| No async required | ✓ | ✓ | ✗ | ✗ |
| Message framing | ✓ | ✗ | ✗ | ~ |
| Message integrity | ✓ | ✗ | ✗ | ✗ |
| Automatic handshake | ✓ | ✗ | ✗ | ✗ |
| Request/Response | ✓ | ✗ | ~ | ✓ |
| Message routing | ✓ | ✗ | ✗ | ~ |
| Auto-reconnect | ✓ | ✗ | ~ | ✓ |
| Non-blocking callbacks | ✓ | ✗ | ✓ | ✓ |
| Built-in ping/pong | ✓ | ✗ | ✗ | ✗ |
| Client tags | ✓ | ✗ | ✗ | ✗ |
| Swappable backends | ✓ | ✗ | ✗ | ✗ |
| Integrated logger | ✓ | ✗ | ~ | ✓ |
Documentation
Contributing
Contributions are welcome. Please read CONTRIBUTING.md before submitting a pull request.
- Bug reports : Open an issue
- Discussions : Join the Discord
- Pull requests : Follow the contribution guide
License
MIT License : see LICENSE for details.
Links
- GitHub : NytroxDev/Veltix
- PyPI : pypi.org/project/veltix
- Documentation : https://nytroxdev.github.io/Veltix/
- Discord : discord.gg/jwjEV5eze7
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file veltix-1.7.0.tar.gz.
File metadata
- Download URL: veltix-1.7.0.tar.gz
- Upload date:
- Size: 69.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
72e4cb9e30361368f40002af280a70e2055e9bd774e235d29b28c72ddefd764f
|
|
| MD5 |
e7be3a0511529a13802b3b2a0d62718c
|
|
| BLAKE2b-256 |
479019bafe9617dbfdd5fec53c8c6ceb1d26964e73bfb2b1e3036f9f9e0b2001
|
File details
Details for the file veltix-1.7.0-py3-none-any.whl.
File metadata
- Download URL: veltix-1.7.0-py3-none-any.whl
- Upload date:
- Size: 70.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a4dbd2b3c79066ae416691ca46316816641fb5a52aaafc0e45fc58500600bf63
|
|
| MD5 |
1fcb661e14e4f6ac0394dc089c8cf0bd
|
|
| BLAKE2b-256 |
6af278b0c9f09c992ea3683614a23c193942337736c5cd9096ac67aef8a59b12
|