Efficient Inter-Process Communication Framework with hierarchical application and channel management
Project description
IPC Framework - Python Package
Efficient Inter-Process Communication Framework with hierarchical application and channel management. Enables seamless bidirectional communication between Python servers and JavaScript/TypeScript clients.
๐ Key Features
- ๐ Bidirectional Communication: Full two-way messaging between Python โ JavaScript
- ๐๏ธ Hierarchical Organization: Applications โ Channels โ Messages
- ๐ก Multiple Patterns: Request/Response, Pub/Sub, Notifications
- ๐ Cross-Language: Python server + JavaScript/TypeScript clients
- โก High Performance: WebSocket-based with optimized binary protocol
- ๐ก๏ธ Built-in Reliability: Auto-reconnection, timeouts, error handling
- ๐ฆ Zero Dependencies: Pure Python implementation
- ๐ฏ Thread-Safe: Safe for multi-threaded applications
โจ What's New in v1.1.0
๐ ๏ธ Critical Bug Fixes:
- โ
Fixed missing
create_response()method - Request/response now working - โ Fixed socket timeout deadlock - Stable connections after handshake
- โ Fixed threading deadlock - Resolved receive/send blocking issue
- โ Fully functional bidirectional communication - Both directions working perfectly
๐ฆ Installation
pip install ipc-framework
๐ฏ Quick Start
Python Server
from ipc_framework import FrameworkServer, MessageType
import time
# Create server
server = FrameworkServer(host="localhost", port=8888)
# Create application and channel
app = server.create_application("my_app", "My Application")
api_channel = app.create_channel("api")
# Handle requests
def handle_request(message):
if message.payload.get('action') == 'get_time':
# Use the working create_response() method!
response = message.create_response({
'success': True,
'time': time.time(),
'message': 'Current server time'
})
connection = server.connection_manager.get_connection(
message.payload.get('connection_id')
)
server.send_to_connection(connection, response)
api_channel.set_handler(MessageType.REQUEST, handle_request)
server.start()
Python Client
from ipc_framework import FrameworkClient
# Create and connect client
client = FrameworkClient("my_app", host="localhost", port=8888)
client.connect()
# Send request and get response
response = client.send_request("api", {
"action": "get_time",
"connection_id": client.connection_id
})
print(f"Server time: {response.payload['time']}")
client.disconnect()
JavaScript Client (Works with Python Server!)
import { IPCClient } from '@ifesol/ipc-framework-js';
const client = new IPCClient('my_app', {
host: 'localhost',
port: 8888
});
await client.connect();
const response = await client.sendRequest('api', {
action: 'get_time',
connection_id: client.connectionId
});
console.log('Server time:', response.payload.time);
๐ Communication Patterns
1. Request/Response (Bidirectional)
# Client โ Server โ Client
response = client.send_request("api", {"action": "get_users"})
2. Pub/Sub Notifications (Server โ Client)
# Server broadcasts to all subscribers
def notification_handler(message):
print(f"Notification: {message.payload}")
client.subscribe("notifications", notification_handler)
3. Real-time Updates (Both Directions)
# Client can trigger server notifications
client.request("api", {"action": "trigger_notification"})
# Server sends real-time updates to all clients
๐ Cross-Language Architecture
โโโโโโโโโโโโโโโโโโโ WebSocket โโโโโโโโโโโโโโโโโโโโ
โ Python Server โ โโโโโโโโโโโโโโโโ โ JavaScript Clientโ
โ โ โ (Browser/Node) โ
โ - Applications โ โ - TypeScript โ
โ - Channels โ โ - React/Vue โ
โ - Message Routing โ - Auto-reconnectโ
โโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโ
๐ Performance & Reliability
| Feature | Status |
|---|---|
| Bidirectional Messaging | โ Working |
| Connection Stability | โ Fixed deadlocks |
| Request/Response | โ Working |
| Pub/Sub | โ Working |
| Error Handling | โ Built-in |
| Thread Safety | โ Fixed |
| Auto-reconnection | โ JS client |
๐ ๏ธ Command Line Tools
The package includes several CLI tools for testing:
# Start demo server
ipc-server
# Interactive chat client
ipc-chat your_username
# File sharing demo
ipc-file
# System monitoring
ipc-monitor
# Full framework demo
ipc-demo
๐ฏ Use Cases
Real-time Applications
- Chat systems with multiple channels
- Live dashboards with metric streaming
- Collaborative editors with real-time updates
- Gaming with real-time state sync
Web Applications
- Python backend โ React frontend
- API servers with real-time notifications
- Microservice communication
- IoT device control
Multi-Process Systems
- Service-to-service communication
- Background task coordination
- Distributed processing
- Event-driven architectures
๐ Documentation
- Complete Documentation - Full guides and examples
- API Reference - Detailed API documentation
- Integration Guide - Framework integration examples
- Examples - Real-world usage examples
๐ Why Choose IPC Framework?
| Traditional IPC | IPC Framework |
|---|---|
| โ Complex setup | โ 3-line setup |
| โ Python-only | โ Python โ JavaScript |
| โ Manual protocols | โ Built-in patterns |
| โ No web support | โ Direct browser clients |
| โ External dependencies | โ Zero dependencies |
๐ Related Packages
- JavaScript Client: @ifesol/ipc-framework-js
- NPM Package: Full TypeScript support for Node.js and browsers
๐ License
MIT License - see LICENSE file for details.
๐ค Contributing
Contributions are welcome! Please feel free to submit issues and pull requests.
Ready for production use! ๐ The framework now provides reliable, bidirectional communication between Python servers and JavaScript clients.
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 ipc_framework-1.1.0.tar.gz.
File metadata
- Download URL: ipc_framework-1.1.0.tar.gz
- Upload date:
- Size: 33.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1ac4b026ce7d39c8c53506a147c1e50092ae51adf2feba9c93179da47a5ac727
|
|
| MD5 |
c01119d5d6d9b025ee34daa29a0cf3d5
|
|
| BLAKE2b-256 |
6d0b258cb793f934f62658f252a9561a1d4b45326ecebd300448efd72f04dc78
|
File details
Details for the file ipc_framework-1.1.0-py3-none-any.whl.
File metadata
- Download URL: ipc_framework-1.1.0-py3-none-any.whl
- Upload date:
- Size: 27.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
39d1c3f029432e46834865a06afe6e032438276fd1ff218fe4ad8687dfd153ac
|
|
| MD5 |
7597b2e80958c3b98da3cde30a4ba6f4
|
|
| BLAKE2b-256 |
2b0ac33ec4af66ab6904fc7fa400fadfc6f3f392295fd0ab4d71096494b90092
|