The networking library you always wanted
Project description
Veltix
The networking library you always wanted
โจ Features
- ๐ Dead simple API - Get started in minutes, not hours
- ๐ Message integrity - Built-in SHA256 hash verification
- ๐ฆ Custom binary protocol - Lightweight and efficient
- ๐ชถ Zero dependencies - Pure Python stdlib only
- ๐ Extensible - Custom message types with plugin support
- โก Multi-threaded - Handle multiple clients automatically
- ๐ Request/Response pattern - Built-in send_and_wait with timeout support
- ๐ก Built-in ping/pong - Automatic latency measurement
๐ Why Veltix?
Existing Python networking libraries are either too low-level (raw sockets) or too complex (Twisted, asyncio). Veltix fills the gap with a simple, modern API that handles the boring parts for you.
Built by a passionate developer who wanted networking to be easy, Veltix focuses on developer experience without sacrificing power or performance.
๐ Installation
pip install veltix
Requirements: Python 3.10+
That's it! Zero dependencies, ready to use.
โก Quick Start
Simple Chat Server
Server (server.py):
from veltix import Server, ServerConfig, MessageType, Request, Binding
# Define message type
CHAT = MessageType(code=200, name="chat")
# Configure server
config = ServerConfig(host="0.0.0.0", port=8080)
server = Server(config)
sender = server.get_sender()
def on_message(client, response):
print(f"[{client.addr[0]}] {response.content.decode()}")
# Broadcast to all
reply = Request(CHAT, f"Echo: {response.content.decode()}".encode())
sender.broadcast(reply, server.get_all_clients_sockets())
server.bind(Binding.ON_RECV, on_message)
server.start()
input("Press Enter to stop...")
server.close_all()
Client (client.py):
from veltix import Client, ClientConfig, MessageType, Request, Binding
CHAT = MessageType(code=200, name="chat")
config = ClientConfig(server_addr="127.0.0.1", port=8080)
client = Client(config)
sender = client.get_sender()
def on_message(response):
print(f"Server: {response.content.decode()}")
client.bind(Binding.ON_RECV, on_message)
client.connect()
# Send message
msg = Request(CHAT, b"Hello Server!")
sender.send(msg)
input("Press Enter to disconnect...")
client.disconnect()
Run:
python server.py
python client.py # In another terminal
๐ Request/Response Pattern
Veltix supports synchronous request-response communication with send_and_wait():
Client Example
from veltix import Client, ClientConfig, MessageType, Request
# Setup
ECHO = MessageType(code=201, name="echo")
client = Client(ClientConfig(server_addr="127.0.0.1", port=8080))
client.connect()
# Send and wait for response
request = Request(ECHO, b"Hello Server!")
response = client.send_and_wait(request, timeout=5.0)
if response:
print(f"Got response: {response.content.decode()}")
print(f"Latency: {response.latency}ms")
else:
print("Timeout or error")
client.disconnect()
Server Example
from veltix import Server, ServerConfig, MessageType, Request, Binding
ECHO = MessageType(code=201, name="echo")
server = Server(ServerConfig(host="0.0.0.0", port=8080))
def on_message(client, response):
# Echo back with same request_id
reply = Request(response.type, response.content, request_id=response.request_id)
server.get_sender().send(reply, client=client.conn)
server.bind(Binding.ON_RECV, on_message)
server.start()
input("Press Enter to stop...")
server.close_all()
Key points:
- Use the same
request_idin the response to match the waiting request - The client automatically receives the response when IDs match
- Built-in timeout support to avoid infinite waiting
๐ก Built-in Ping/Pong
Veltix includes automatic ping/pong functionality for measuring latency:
Client to Server Ping
from veltix import Client, ClientConfig
client = Client(ClientConfig(server_addr="127.0.0.1", port=8080))
client.connect()
# Ping the server
latency = client.ping_server(timeout=2.0)
if latency:
print(f"Server latency: {latency}ms")
else:
print("Ping timeout")
client.disconnect()
Server to Client Ping
from veltix import Server, ServerConfig, Binding
server = Server(ServerConfig(host="0.0.0.0", port=8080))
def on_connect(client):
# Ping client when they connect
latency = server.ping_client(client, timeout=2.0)
if latency:
print(f"Client {client.addr} latency: {latency}ms")
server.bind(Binding.ON_CONNECT, on_connect)
server.start()
input("Press Enter to stop...")
server.close_all()
Features:
- Automatic PING/PONG handling (no manual implementation needed)
- Returns latency in milliseconds
- Built-in timeout support
- Works bidirectionally (client โ server)
๐ฆ Examples
More examples in examples/:
- Echo Server - Simple echo implementation with send_and_wait
- Chat Server - Simple Chat in < 80 lines
- Ping Example - Latency measurement demonstrations
๐ฏ Advanced Features
Custom Message Types
from veltix import MessageType
# System messages (0-199)
PING = MessageType(0, "ping", "System ping message")
# User messages (200-499)
CHAT = MessageType(200, "chat", "Chat message")
FILE_TRANSFER = MessageType(201, "file", "File transfer")
# Plugin messages (500+)
CUSTOM_PLUGIN = MessageType(500, "plugin", "Custom plugin message")
Event Callbacks
from veltix import Server, Binding
server = Server(config)
# Bind to connection event
server.bind(Binding.ON_CONNECT, lambda client: print(f"Client connected: {client.addr}"))
# Bind to message event
server.bind(Binding.ON_RECV, lambda client, msg: print(f"Message from {client.addr}"))
Broadcasting
# Broadcast to all connected clients
message = Request(CHAT, b"Server announcement!")
sender.broadcast(message, server.get_all_clients_sockets())
๐ Comparison
| Feature | Veltix | socket | asyncio | Twisted |
|---|---|---|---|---|
| Easy API | โ | โ | โ ๏ธ | โ |
| Zero deps | โ | โ | โ | โ |
| Custom protocol | โ | โ | โ | โ ๏ธ |
| Message integrity | โ | โ | โ | โ |
| Multi-threading | โ | โ | โ | โ |
| Request/Response | โ | โ | โ ๏ธ | โ |
| Built-in ping/pong | โ | โ | โ | โ |
๐บ๏ธ Roadmap
v1.1.0 - Request/Response (February 2026) โ
- Request/Response pattern with send_and_wait
- Built-in ping/pong functionality
- Automatic latency measurement
- UUID-based request tracking
- Status: RELEASED
v2.0.0 - Security (Summer 2026)
- End-to-end encryption (ChaCha20 + X25519 + Ed25519)
- Automatic key exchange
- Perfect forward secrecy
- Status: PLANNED
v3.0.0 - Performance (Fall 2026)
- Rust core via PyO3
- 10-100x speed improvements
- Advanced optimizations
- Status: RESEARCH
v4.0.0+ (2027+)
- UDP support
- Plugin ecosystem
- Compression
- WebSocket bridge
๐ค Contributing
We welcome contributions! See CONTRIBUTING.md for guidelines.
Quick ways to help:
- โญ Star the project
- ๐ Report bugs
- ๐ Improve documentation
- ๐ป Submit pull requests
- ๐ฌ Join discussions
๐ Contributors
Core Team
- Nytrox - Creator & Lead Developer
Community Heroes
Thank you to everyone who has contributed through code, documentation, bug reports, and support!
Want to be listed here? Check out our Contributing guide!
๐ License
MIT License - see LICENSE file for details.
๐ Links
- Documentation: Coming soon
- GitHub: NytroxDev/Veltix
- PyPI: pypi.org/project/veltix
- Issues: Report a bug
Built with โค๏ธ by Nytrox
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.1.0.tar.gz.
File metadata
- Download URL: veltix-1.1.0.tar.gz
- Upload date:
- Size: 11.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
02c41d70548e263d3e1e1331638c132275c941cf7b4433d29b003aa96c39df80
|
|
| MD5 |
c3eda24bb3960688551c78d56662766f
|
|
| BLAKE2b-256 |
89d2e48f23706a4fb7493466fa7de0498efceb3b76d2028b3056d096ef4b2fb9
|
File details
Details for the file veltix-1.1.0-py3-none-any.whl.
File metadata
- Download URL: veltix-1.1.0-py3-none-any.whl
- Upload date:
- Size: 6.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
55cf7b25da8a4bd49323e68f9e9c3f94fbb01a7b7c31d6630a6186cc9832452b
|
|
| MD5 |
3d80c738838646ac3e6141bb1e0a5aae
|
|
| BLAKE2b-256 |
91d331d9ba78a309918bf04b1e522257a01cc472dd79990c0b76bb83a40bb03a
|