# IPC Framework - Inter-Process Communication
[](https://www.npmjs.com/package/@ifesol/ipc-framework-nodejs)
[](https://opensource.org/licenses/MIT)
**Efficient Inter-Process Communication Framework** for **Python ↔ Node.js** backend integration. This is the **Python server package** that enables seamless **bidirectional communication** with Node.js applications using TCP sockets.
## 🐍 **Python Server Package**
This package provides the **Python IPC server** for communication with Node.js clients.
**✅ Production Ready Features:**
- ✅ TCP socket server (high-performance, low-latency)
- ✅ Hierarchical application and channel management
- ✅ Request/response and publish/subscribe patterns
- ✅ Connection pooling and auto-reconnection support
- ✅ Thread-safe operation with robust error handling
## 🚀 **Quick Start**
### **Installation**
```bash
# Install Python IPC server
pip install ipc-framework
# Install Node.js client (separate package)
npm install @ifesol/ipc-framework-nodejs
```
### **Python Server Usage**
```python
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 from Node.js clients
def handle_request(message):
action = message.payload.get('action')
if action == 'get_data':
response = message.create_response({
'success': True,
'data': {'timestamp': time.time(), 'message': 'Hello from Python!'},
'server': 'Python IPC Framework'
})
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)
print("🐍 Python IPC Server starting on localhost:8888")
server.start()
```
### **Node.js Client Usage**
```javascript
const { IPCClient } = require('@ifesol/ipc-framework-nodejs');
async function main() {
const client = new IPCClient('my_app', {
host: 'localhost',
port: 8888
});
try {
await client.connect();
console.log('✅ Connected to Python server!');
const response = await client.sendRequest('api', {
action: 'get_data'
});
console.log('📨 Response from Python:', response.payload);
} catch (error) {
console.error('❌ Error:', error.message);
} finally {
client.disconnect();
}
}
main();
```
## 🎯 **Architecture Features**
### **✅ Production-Ready Server:**
- **High-performance TCP sockets** for low-latency communication
- **Hierarchical structure** with applications and channels
- **Message routing** and automatic connection management
- **Thread-safe operations** with robust error handling
### **✅ Communication Patterns:**
- **Request/Response** - Direct client-server communication
- **Publish/Subscribe** - Real-time notifications and broadcasts
- **Channel-based routing** - Organized message handling
- **Connection pooling** - Efficient resource management
## 🏗️ **Integration with Node.js**
This Python server works seamlessly with Node.js applications. Here's how to connect an Express.js app:
**Node.js Express.js Integration:**
```javascript
const express = require('express');
const { IPCClient } = require('@ifesol/ipc-framework-nodejs');
const app = express();
const pythonClient = new IPCClient('web_api');
app.use(express.json());
// Initialize connection to Python IPC server
pythonClient.connect().then(() => {
console.log('🔗 Connected to Python IPC server');
});
// API endpoint proxying to Python backend
app.post('/api/process', async (req, res) => {
try {
const result = await pythonClient.sendRequest('processing', {
action: 'process_user_data',
data: req.body,
connection_id: pythonClient.connectionId
});
res.json(result.payload);
} catch (error) {
res.status(500).json({ error: error.message });
}
});
app.listen(3000, () => {
console.log('🌐 Express server running on port 3000');
console.log('📡 Proxying requests to Python IPC server');
});
```
## 📊 **Performance Characteristics**
| Feature | Performance | Details |
|---------|-------------|---------|
| **Connection Handling** | Sub-millisecond | Fast TCP connection establishment |
| **Message Processing** | <1ms latency | Direct socket communication |
| **Concurrent Connections** | 100+ clients | Thread-safe connection management |
| **Message Throughput** | High-volume | Efficient message routing |
| **Memory Usage** | Low footprint | Optimized Python implementation |
| **Error Recovery** | Automatic | Robust connection cleanup |
## 🎯 **Use Cases**
This Python IPC server enables powerful hybrid architectures:
### **Backend Services**
- **AI/ML model serving** - Host machine learning models and serve predictions to Node.js frontends
- **Data processing pipelines** - Heavy computational tasks handled by Python, coordinated with Node.js
- **Real-time analytics** - Python analytics engines feeding real-time dashboards
- **Scientific computing** - NumPy/SciPy computations accessible from Node.js applications
### **Microservice Architecture**
- **Polyglot microservices** - Python services integrated with Node.js API gateways
- **Event-driven architecture** - Python services publishing events to Node.js consumers
- **Service mesh integration** - Python backend services in cloud-native environments
- **Legacy system integration** - Bridge existing Python systems with modern Node.js frontends
### **Hybrid Applications**
- **E-commerce platforms** - Python inventory/pricing engines with Node.js storefronts
- **Financial services** - Python quantitative analysis with Node.js trading interfaces
- **IoT platforms** - Python device controllers with Node.js monitoring dashboards
- **Chat applications** - Python NLP processing with Node.js real-time messaging
## 🆚 **Why Choose IPC over HTTP?**
| HTTP API Approach | IPC Framework |
|-------------------|---------------|
| ❌ High latency overhead | ✅ Direct TCP communication |
| ❌ Request/response only | ✅ Request/response + pub/sub |
| ❌ Manual connection management | ✅ Automatic reconnection |
| ❌ Complex error handling | ✅ Built-in fault tolerance |
| ❌ No real-time capabilities | ✅ Live notifications |
| ❌ Stateless limitations | ✅ Persistent connections |
## 🔗 **Companion Packages**
This Python server works with the Node.js client package:
- **Node.js Client**: [@ifesol/ipc-framework-nodejs](https://www.npmjs.com/package/@ifesol/ipc-framework-nodejs) - Production-ready TCP client
- **Installation**: `npm install @ifesol/ipc-framework-nodejs`
- **Documentation**: [Node.js Package Docs](https://www.npmjs.com/package/@ifesol/ipc-framework-nodejs)
## 🚀 **Getting Started**
1. **Install the Python server:**
```bash
pip install ipc-framework
```
2. **Install the Node.js client:**
```bash
npm install @ifesol/ipc-framework-nodejs
```
3. **Run the examples above** to see the integration in action!
## 📚 **Documentation**
- [Python API Reference](https://github.com/ifesol/ipc-framework#python-api)
- [Node.js Client Usage](https://www.npmjs.com/package/@ifesol/ipc-framework-nodejs)
- [Integration Examples](https://github.com/ifesol/ipc-framework/tree/main/examples)
## 📄 License
MIT License - see [LICENSE](LICENSE) file for details.
## 🤝 Contributing
Contributions welcome! Help us improve the Python ↔ Node.js IPC communication experience.
Raw data
{
"_id": null,
"home_page": "https://github.com/ifesol/ipc-framework",
"name": "ipc-framework",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.7",
"maintainer_email": "IPC Framework Team <ifesol@example.com>",
"keywords": "ipc, inter-process-communication, tcp, sockets, nodejs, python, server, microservices, real-time, messaging",
"author": "IPC Framework Team",
"author_email": "IPC Framework Team <ifesol@example.com>",
"download_url": "https://files.pythonhosted.org/packages/a4/fd/477ccadec725ffc64d1f8bbe4ec615e6242624ae9d82cf089f9bce3027a4/ipc_framework-1.1.2.tar.gz",
"platform": null,
"description": "# IPC Framework - Inter-Process Communication\r\n\r\n[](https://www.npmjs.com/package/@ifesol/ipc-framework-nodejs)\r\n[](https://opensource.org/licenses/MIT)\r\n\r\n**Efficient Inter-Process Communication Framework** for **Python \u2194 Node.js** backend integration. This is the **Python server package** that enables seamless **bidirectional communication** with Node.js applications using TCP sockets.\r\n\r\n## \ud83d\udc0d **Python Server Package**\r\n\r\nThis package provides the **Python IPC server** for communication with Node.js clients.\r\n\r\n**\u2705 Production Ready Features:**\r\n- \u2705 TCP socket server (high-performance, low-latency)\r\n- \u2705 Hierarchical application and channel management\r\n- \u2705 Request/response and publish/subscribe patterns\r\n- \u2705 Connection pooling and auto-reconnection support\r\n- \u2705 Thread-safe operation with robust error handling\r\n\r\n## \ud83d\ude80 **Quick Start**\r\n\r\n### **Installation**\r\n\r\n```bash\r\n# Install Python IPC server\r\npip install ipc-framework\r\n\r\n# Install Node.js client (separate package)\r\nnpm install @ifesol/ipc-framework-nodejs\r\n```\r\n\r\n### **Python Server Usage**\r\n\r\n```python\r\nfrom ipc_framework import FrameworkServer, MessageType\r\nimport time\r\n\r\n# Create server\r\nserver = FrameworkServer(host=\"localhost\", port=8888)\r\n\r\n# Create application and channel\r\napp = server.create_application(\"my_app\", \"My Application\")\r\napi_channel = app.create_channel(\"api\")\r\n\r\n# Handle requests from Node.js clients\r\ndef handle_request(message):\r\n action = message.payload.get('action')\r\n \r\n if action == 'get_data':\r\n response = message.create_response({\r\n 'success': True,\r\n 'data': {'timestamp': time.time(), 'message': 'Hello from Python!'},\r\n 'server': 'Python IPC Framework'\r\n })\r\n \r\n connection = server.connection_manager.get_connection(\r\n message.payload.get('connection_id')\r\n )\r\n server.send_to_connection(connection, response)\r\n\r\napi_channel.set_handler(MessageType.REQUEST, handle_request)\r\n\r\nprint(\"\ud83d\udc0d Python IPC Server starting on localhost:8888\")\r\nserver.start()\r\n```\r\n\r\n### **Node.js Client Usage**\r\n\r\n```javascript\r\nconst { IPCClient } = require('@ifesol/ipc-framework-nodejs');\r\n\r\nasync function main() {\r\n const client = new IPCClient('my_app', {\r\n host: 'localhost',\r\n port: 8888\r\n });\r\n\r\n try {\r\n await client.connect();\r\n console.log('\u2705 Connected to Python server!');\r\n\r\n const response = await client.sendRequest('api', {\r\n action: 'get_data'\r\n });\r\n\r\n console.log('\ud83d\udce8 Response from Python:', response.payload);\r\n } catch (error) {\r\n console.error('\u274c Error:', error.message);\r\n } finally {\r\n client.disconnect();\r\n }\r\n}\r\n\r\nmain();\r\n```\r\n\r\n## \ud83c\udfaf **Architecture Features**\r\n\r\n### **\u2705 Production-Ready Server:**\r\n- **High-performance TCP sockets** for low-latency communication\r\n- **Hierarchical structure** with applications and channels\r\n- **Message routing** and automatic connection management\r\n- **Thread-safe operations** with robust error handling\r\n\r\n### **\u2705 Communication Patterns:**\r\n- **Request/Response** - Direct client-server communication\r\n- **Publish/Subscribe** - Real-time notifications and broadcasts\r\n- **Channel-based routing** - Organized message handling\r\n- **Connection pooling** - Efficient resource management\r\n\r\n## \ud83c\udfd7\ufe0f **Integration with Node.js**\r\n\r\nThis Python server works seamlessly with Node.js applications. Here's how to connect an Express.js app:\r\n\r\n**Node.js Express.js Integration:**\r\n```javascript\r\nconst express = require('express');\r\nconst { IPCClient } = require('@ifesol/ipc-framework-nodejs');\r\n\r\nconst app = express();\r\nconst pythonClient = new IPCClient('web_api');\r\n\r\napp.use(express.json());\r\n\r\n// Initialize connection to Python IPC server\r\npythonClient.connect().then(() => {\r\n console.log('\ud83d\udd17 Connected to Python IPC server');\r\n});\r\n\r\n// API endpoint proxying to Python backend\r\napp.post('/api/process', async (req, res) => {\r\n try {\r\n const result = await pythonClient.sendRequest('processing', {\r\n action: 'process_user_data',\r\n data: req.body,\r\n connection_id: pythonClient.connectionId\r\n });\r\n \r\n res.json(result.payload);\r\n } catch (error) {\r\n res.status(500).json({ error: error.message });\r\n }\r\n});\r\n\r\napp.listen(3000, () => {\r\n console.log('\ud83c\udf10 Express server running on port 3000');\r\n console.log('\ud83d\udce1 Proxying requests to Python IPC server');\r\n});\r\n```\r\n\r\n## \ud83d\udcca **Performance Characteristics**\r\n\r\n| Feature | Performance | Details |\r\n|---------|-------------|---------|\r\n| **Connection Handling** | Sub-millisecond | Fast TCP connection establishment |\r\n| **Message Processing** | <1ms latency | Direct socket communication |\r\n| **Concurrent Connections** | 100+ clients | Thread-safe connection management |\r\n| **Message Throughput** | High-volume | Efficient message routing |\r\n| **Memory Usage** | Low footprint | Optimized Python implementation |\r\n| **Error Recovery** | Automatic | Robust connection cleanup |\r\n\r\n## \ud83c\udfaf **Use Cases**\r\n\r\nThis Python IPC server enables powerful hybrid architectures:\r\n\r\n### **Backend Services**\r\n- **AI/ML model serving** - Host machine learning models and serve predictions to Node.js frontends\r\n- **Data processing pipelines** - Heavy computational tasks handled by Python, coordinated with Node.js\r\n- **Real-time analytics** - Python analytics engines feeding real-time dashboards\r\n- **Scientific computing** - NumPy/SciPy computations accessible from Node.js applications\r\n\r\n### **Microservice Architecture**\r\n- **Polyglot microservices** - Python services integrated with Node.js API gateways\r\n- **Event-driven architecture** - Python services publishing events to Node.js consumers\r\n- **Service mesh integration** - Python backend services in cloud-native environments\r\n- **Legacy system integration** - Bridge existing Python systems with modern Node.js frontends\r\n\r\n### **Hybrid Applications**\r\n- **E-commerce platforms** - Python inventory/pricing engines with Node.js storefronts\r\n- **Financial services** - Python quantitative analysis with Node.js trading interfaces\r\n- **IoT platforms** - Python device controllers with Node.js monitoring dashboards\r\n- **Chat applications** - Python NLP processing with Node.js real-time messaging\r\n\r\n## \ud83c\udd9a **Why Choose IPC over HTTP?**\r\n\r\n| HTTP API Approach | IPC Framework |\r\n|-------------------|---------------|\r\n| \u274c High latency overhead | \u2705 Direct TCP communication |\r\n| \u274c Request/response only | \u2705 Request/response + pub/sub |\r\n| \u274c Manual connection management | \u2705 Automatic reconnection |\r\n| \u274c Complex error handling | \u2705 Built-in fault tolerance |\r\n| \u274c No real-time capabilities | \u2705 Live notifications |\r\n| \u274c Stateless limitations | \u2705 Persistent connections |\r\n\r\n## \ud83d\udd17 **Companion Packages**\r\n\r\nThis Python server works with the Node.js client package:\r\n\r\n- **Node.js Client**: [@ifesol/ipc-framework-nodejs](https://www.npmjs.com/package/@ifesol/ipc-framework-nodejs) - Production-ready TCP client\r\n- **Installation**: `npm install @ifesol/ipc-framework-nodejs`\r\n- **Documentation**: [Node.js Package Docs](https://www.npmjs.com/package/@ifesol/ipc-framework-nodejs)\r\n\r\n## \ud83d\ude80 **Getting Started**\r\n\r\n1. **Install the Python server:**\r\n ```bash\r\n pip install ipc-framework\r\n ```\r\n\r\n2. **Install the Node.js client:**\r\n ```bash\r\n npm install @ifesol/ipc-framework-nodejs\r\n ```\r\n\r\n3. **Run the examples above** to see the integration in action!\r\n\r\n## \ud83d\udcda **Documentation**\r\n\r\n- [Python API Reference](https://github.com/ifesol/ipc-framework#python-api)\r\n- [Node.js Client Usage](https://www.npmjs.com/package/@ifesol/ipc-framework-nodejs)\r\n- [Integration Examples](https://github.com/ifesol/ipc-framework/tree/main/examples)\r\n\r\n## \ud83d\udcc4 License\r\n\r\nMIT License - see [LICENSE](LICENSE) file for details.\r\n\r\n## \ud83e\udd1d Contributing\r\n\r\nContributions welcome! Help us improve the Python \u2194 Node.js IPC communication experience. \r\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Python IPC server for high-performance communication with Node.js applications using TCP sockets",
"version": "1.1.2",
"project_urls": {
"Bug Tracker": "https://github.com/ifesol/ipc-framework/issues",
"Documentation": "https://github.com/ifesol/ipc-framework#readme",
"Homepage": "https://github.com/ifesol/ipc-framework",
"Repository": "https://github.com/ifesol/ipc-framework.git"
},
"split_keywords": [
"ipc",
" inter-process-communication",
" tcp",
" sockets",
" nodejs",
" python",
" server",
" microservices",
" real-time",
" messaging"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "3851677270f787e897b42fa8ad0597d5f1864d495d9f73b6db5e778f6798a62b",
"md5": "f9297d970cceec77aa0102ddbbe519e5",
"sha256": "87c42cbd4c4da9f3c00ebe8a91ac66322064f87f748ce60ed97ac53793d013e0"
},
"downloads": -1,
"filename": "ipc_framework-1.1.2-py3-none-any.whl",
"has_sig": false,
"md5_digest": "f9297d970cceec77aa0102ddbbe519e5",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.7",
"size": 27508,
"upload_time": "2025-07-23T22:25:50",
"upload_time_iso_8601": "2025-07-23T22:25:50.724446Z",
"url": "https://files.pythonhosted.org/packages/38/51/677270f787e897b42fa8ad0597d5f1864d495d9f73b6db5e778f6798a62b/ipc_framework-1.1.2-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "a4fd477ccadec725ffc64d1f8bbe4ec615e6242624ae9d82cf089f9bce3027a4",
"md5": "39ec7c886e0fd447f928c00c6e73b98d",
"sha256": "bf777063eac1373ea1f83e2b636009e66cf68b4daf94f6b1c81ea67e7decbe9b"
},
"downloads": -1,
"filename": "ipc_framework-1.1.2.tar.gz",
"has_sig": false,
"md5_digest": "39ec7c886e0fd447f928c00c6e73b98d",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.7",
"size": 81044,
"upload_time": "2025-07-23T22:25:51",
"upload_time_iso_8601": "2025-07-23T22:25:51.756456Z",
"url": "https://files.pythonhosted.org/packages/a4/fd/477ccadec725ffc64d1f8bbe4ec615e6242624ae9d82cf089f9bce3027a4/ipc_framework-1.1.2.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-07-23 22:25:51",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "ifesol",
"github_project": "ipc-framework",
"github_not_found": true,
"lcname": "ipc-framework"
}