Virtual IPC (VAP)

The Virtual Asset Provider (VAP) is Pytron-kit's high-performance, zero-copy binary bridge. It enables the streaming of large datasets, video frames, and AI tensors between Python and the user interface without the performance overhead of Base64 encoding.

Efficient Data Transfer

Standard webview communication typically requires converting binary data into strings, which increases data size by approximately 33% and consumes significant CPU resources during encoding and decoding.

VAP bypasses this limitation by allowing the Python backend to serve raw data directly into a memory pool that the frontend can access using standard web protocols.

The pytron:// Protocol

Pytron-kit intercepts the custom pytron:// protocol, allowing the user interface to request assets directly from the Python runtime.

1. Register Data in Python

python
# Serve raw binary data directly
image_bytes = model.generate_image()
window.serve_data("active-frame", image_bytes, "image/jpeg")

2. Access from the Frontend

Once served, the data is accessible via a standard URL in your UI components or fetch calls.

jsx
// Standard HTML/UI tag
<img src="pytron://active-frame" />

// Native fetch call
const res = await fetch('pytron://active-frame');
const data = await res.arrayBuffer();

Technical Architecture

Since underlying IPC channels are often string-based, Pytron-kit utilizes a specialized mapping technique to transport raw bits inside string containers without corruption. The frontend interceptor then reconstructs these bits into typed arrays (e.g., Uint8Array) for use in the browser environment.

Virtual File System

VAP also provides a secure sandbox for application assets. Files within the project root can be accessed via the custom protocol, providing a more secure and efficient alternative to file:// URLs with built-in path-traversal protection.

bash
pytron://app/assets/branding/logo.png