BrowserOutput¶
sink extra: browser-output
Hand the messages of the pipeline over to the web page hosting it.
- Node type:
BrowserOutput- Input:
AudioPayload,ImagePayload,BytesPayloadorObjectPayload- Output:
–
- Extra:
browser-output
$ pip install "juturna-nodes[browser-output]"
The node runs only in a Pyodide Worker, with the browser transport of juturna.
It encodes each message in the wire format of
juturna.transport.browser._io and posts
{type: 'output', node, message} to the page with the postMessage of the
Worker. Any other payload type is logged and counted as an update failure.
How it works¶
update() encodes the message in the wire format of
juturna/transport/browser/_io.py and posts it to the page with the
Worker’s postMessage. Arrays reach the page as typed arrays.
Arguments¶
None.
Input message¶
Any message whose payload is an AudioPayload, ImagePayload,
BytesPayload or ObjectPayload. Other payload types raise TypeError,
which the node logs and counts in update_failures without stopping.
Audio:
audio(flattened),sampling_rate,channels,start,end,audio_format.Image:
image(flattened),width,height,depth,pixel_format,timestamp. A page needswidth,heightanddepthto rebuild the image.meta: sent as JSON; values that are not JSON-compatible are converted withstr(). No key is required.
Output message¶
Nothing goes down the pipeline. The page receives, through postMessage:
{type: 'output', node: <node name>,
message: {kind, payload, meta, creator, id, created_at}}
kind is audio, image, bytes or object, and payload carries the
fields listed above.
License¶
Code: this node is part of juturna-nodes, MIT (its
LICENSEfile).Pyodide: the node runs in the browser on Pyodide, MPL-2.0.
Configuration¶
Default node arguments, as defined in the node config.toml file. Any of
them can be overridden in the node configuration of a pipeline.
[arguments]
[meta]
Pipeline usage¶
{
"name": "browser_output",
"type": "BrowserOutput",
"configuration": {}
}
Reference¶
- class BrowserOutput(
- node_name: str = '',
- pipe_name: str = '',
- transport: TransportBackend | None = None,
Hand the received messages over to the page.