Skip to main content

Efficient Inter-Process Communication Framework with hierarchical application and channel management

Project description

IPC Framework - Python Package

PyPI version Python versions License: MIT

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

๐Ÿ†š 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

๐Ÿ“„ 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ipc_framework-1.1.0.tar.gz (33.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ipc_framework-1.1.0-py3-none-any.whl (27.2 kB view details)

Uploaded Python 3

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

Hashes for ipc_framework-1.1.0.tar.gz
Algorithm Hash digest
SHA256 1ac4b026ce7d39c8c53506a147c1e50092ae51adf2feba9c93179da47a5ac727
MD5 c01119d5d6d9b025ee34daa29a0cf3d5
BLAKE2b-256 6d0b258cb793f934f62658f252a9561a1d4b45326ecebd300448efd72f04dc78

See more details on using hashes here.

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

Hashes for ipc_framework-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 39d1c3f029432e46834865a06afe6e032438276fd1ff218fe4ad8687dfd153ac
MD5 7597b2e80958c3b98da3cde30a4ba6f4
BLAKE2b-256 2b0ac33ec4af66ab6904fc7fa400fadfc6f3f392295fd0ab4d71096494b90092

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page