Skip to main content

IPC Framework - Inter-Process Communication

NPM companion License: 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

# Install Python IPC server
pip install ipc-framework

# Install Node.js client (separate package)
npm install @ifesol/ipc-framework-nodejs

Python Server Usage

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

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:

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:

🚀 Getting Started

  1. Install the Python server:

    pip install ipc-framework
    
  2. Install the Node.js client:

    npm install @ifesol/ipc-framework-nodejs
    
  3. Run the examples above to see the integration in action!

📚 Documentation

📄 License

MIT License - see LICENSE file for details.

🤝 Contributing

Contributions welcome! Help us improve the Python ↔ Node.js IPC communication experience.

Metadata

Release files for ipc-framework 1.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ipc-framework 1.1.2
File Size Uploaded Provenance Actions
ipc_framework-1.1.2.tar.gz 81.0 kB Without provenance Details for ipc_framework-1.1.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for ipc-framework 1.1.2
File Interpreter ABI Platform Actions
ipc_framework-1.1.2-py3-none-any.whl Python 3 none any Details for ipc_framework-1.1.2-py3-none-any.whl

Total release size: 108.6 kB

Release files / ipc_framework-1.1.2.tar.gz

Download URL ipc_framework-1.1.2.tar.gz
Size 81.0 kB
Tags Source
SHA-256 checksum
How to use checksums
bf777063eac1373ea1f83e2b636009e66cf68b4daf94f6b1c81ea67e7decbe9b
BLAKE2b-256 checksum
How to use checksums
a4fd477ccadec725ffc64d1f8bbe4ec615e6242624ae9d82cf089f9bce3027a4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.4

Release files / ipc_framework-1.1.2-py3-none-any.whl

Download URL ipc_framework-1.1.2-py3-none-any.whl
Size 27.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
87c42cbd4c4da9f3c00ebe8a91ac66322064f87f748ce60ed97ac53793d013e0
BLAKE2b-256 checksum
How to use checksums
3851677270f787e897b42fa8ad0597d5f1864d495d9f73b6db5e778f6798a62b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.4

Security for ipc-framework 1.1.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page