Skip to main content

Crate vzglyd_sidecar

Crate vzglyd_sidecar 

Source
Expand description

§vzglyd_sidecar

Networking and IPC utilities for VZGLYD slide sidecars.

A sidecar is a companion wasm32-wasip1 program that fetches external data and pushes it into a paired slide over the VZGLYD host channel.

§Typical Structure

use vzglyd_sidecar::{https_get_text, poll_loop};

fn main() {
    poll_loop(60, || {
        let body = https_get_text("api.example.com", "/data")?;
        Ok(body.into_bytes())
    });
}

This crate is primarily intended for the wasm32-wasip1 target used by VZGLYD sidecars.

Enums§

Error
Errors returned by network and channel helpers.

Functions§

channel_active
Return true when the paired slide is currently active on screen.
channel_poll
Poll the shared channel for the latest payload.
channel_push
Push a new payload into the shared sidecar-to-slide channel.
env_var
Read an environment variable from the sidecar process.
https_get
Perform an HTTPS GET request and return the raw response body.
https_get_conditional
Perform a conditional HTTPS GET request using ETag and Last-Modified hints.
https_get_text
Perform an HTTPS GET request and decode the body as UTF-8 text.
info_log
Emit an informational log message through the VZGLYD host.
poll_loop
Repeatedly fetch payloads and push them into the slide channel.
sleep_secs
Sleep for a whole number of seconds.
split_https_url
Split an HTTPS URL into (host, path) for use with https_get helpers.
tcp_connect
Attempt a TCP connection and return the time taken to establish it.

Type Aliases§

ConditionalGetResult
Body, ETag, and Last-Modified returned by a conditional GET.