Panel Content
Serve web pages to GUI panels from this session, and exchange JSON messages with them. More...
Typedefs Index
| typedef | void(* qar_panel_content_message_callback_t)(const QarPanelContentMessage *message, void *user_state) |
|
Called once per message a panel showing the bundle sent. More... | |
Functions Index
| static QarResult | qar_panel_content_post_message (QarSession *session, const QarPanelContentBundleId *bundle, const QarGuiPanelId *panel, const QarPeerId *user, const char *json) |
|
Post one JSON value to the panels showing a bundle this session published. More... | |
| static QarResult | qar_panel_content_publish_directory (QarSession *session, const char *name, const char *root_utf8, QarPanelContentBundleId *out_bundle) |
|
Publish every regular file under a folder as bundle name. More... | |
| static QarResult | qar_panel_content_publish_files (QarSession *session, const char *name, const QarPanelContentFile *files, size_t count, QarPanelContentBundleId *out_bundle) |
|
Publish count files as bundle name. More... | |
| static QarResult | qar_panel_content_remove (QarSession *session, const QarPanelContentBundleId *bundle) |
|
Stop serving a bundle. Panels showing it stay and show nothing. More... | |
| static QarResult | qar_panel_content_subscribe_messages (QarSession *session, const QarPanelContentBundleId *bundle, qar_panel_content_message_callback_t callback, void *user_state, QarCancelToken *token) |
|
Receive the messages of every panel showing a bundle this session published, each stamped with its panel and user. More... | |
Description
Serve web pages to GUI panels from this session, and exchange JSON messages with them.
A served GUI panel shows a page of a content bundle: a named, versioned set of files this session publishes once. Every user's mixer loads the page in its own browser, fetching the files over the session from this session, so each user has their own page state, scroll and focus. The page and this session exchange JSON messages: qaros.panel.send(msg) and qaros.panel.onMessage(cb) in the page, qar_panel_content_subscribe_messages() and qar_panel_content_post_message() here.
- Publishing copies every byte at publish time. Nothing on disk is read while serving, so a request can only reach a file the bundle lists; an edit needs another publication, which bumps the bundle's version and makes every mixer reload the panels showing it.
- The publisher owns the content: only it may put the bundle on a panel (QarGuiPanelServedContentExt, qar_gui_panels_set_served_content()), receives the panels' messages and posts to them. Anyone allowed may still move, resize, hide or close the panel.
- The pages are served under their own web origin per publishing session, with a strict content security policy: scripts and styles from the bundle only, no network access.
- Limits: 16 MiB per file, 64 MiB and 1024 files per bundle, 64 KiB per message.
Typedefs
qar_panel_content_message_callback_t
|
Called once per message a panel showing the bundle sent.
Documented on the public declaration in <qar_streaming_c/v0/api.h>.
Runs on a library thread; message is valid only during the call.
Definition at line 5533 of file qar_streaming.h.
Functions
qar_panel_content_post_message()
| inline static |
Post one JSON value to the panels showing a bundle this session published.
- Parameters
-
session Session that published bundle; must not be NULL.
bundle Bundle whose panels receive it; must not be NULL.
panel One panel, or NULL for every panel showing the bundle.
user One user, or NULL for every user.
json One JSON value, at most 64 KiB, copied; must not be NULL.
- Returns
Success, QAR_STATUS_PANEL_CONTENT_MESSAGE_REFUSED, QAR_STATUS_PANEL_CONTENT_NOT_PUBLISHER, or QAR_STATUS_PANEL_CONTENT_NOT_FOUND.
Definition at line 5633 of file qar_streaming.h.
qar_panel_content_publish_directory()
| inline static |
Publish every regular file under a folder as bundle name.
Replaces an earlier publication of the same name and bumps its version. A link inside the folder is refused, as is every file qar_panel_content_publish_files() would refuse. File types come from their extensions (html, js, mjs, css, json, svg, png, jpg, gif, webp, ico, woff, woff2, ttf, otf, txt, wasm, glb, gltf, bin, mp3, ogg, wav, mp4, webm, xml, map).
- Parameters
-
session Session that serves the bundle; must not be NULL.
name Bundle name (see QarPanelContentBundleId::name); must not be NULL.
root_utf8 Folder to publish, UTF-8; must not be NULL.
out_bundle Receives the bundle id; must not be NULL.
- Returns
Success, or one of the QAR_STATUS_PANEL_CONTENT_* refusals; nothing is published when the call fails.
Definition at line 5555 of file qar_streaming.h.
qar_panel_content_publish_files()
| inline static |
Publish count files as bundle name.
Replaces an earlier publication of the same name and bumps its version.
- Parameters
-
session Session that serves the bundle; must not be NULL.
name Bundle name (see QarPanelContentBundleId::name); must not be NULL.
files Files to publish, copied during the call; must not be NULL.
count Number of files, 1 to 1024.
out_bundle Receives the bundle id; must not be NULL.
- Returns
Success; QAR_STATUS_PANEL_CONTENT_BUNDLE_REFUSED for a bad name; QAR_STATUS_PANEL_CONTENT_PATH_REFUSED for a bad or duplicate path; QAR_STATUS_PANEL_CONTENT_MIME_REFUSED for a type that is not served; QAR_STATUS_PANEL_CONTENT_SIZE_REFUSED for a limit exceeded. Nothing is published when the call fails.
Definition at line 5579 of file qar_streaming.h.
qar_panel_content_remove()
| inline static |
Stop serving a bundle. Panels showing it stay and show nothing.
- Parameters
-
session Session that published bundle; must not be NULL.
bundle Bundle to remove; must not be NULL.
- Returns
Success, QAR_STATUS_PANEL_CONTENT_NOT_PUBLISHER, or QAR_STATUS_PANEL_CONTENT_NOT_FOUND.
Definition at line 5595 of file qar_streaming.h.
qar_panel_content_subscribe_messages()
| inline static |
Receive the messages of every panel showing a bundle this session published, each stamped with its panel and user.
- Parameters
-
session Session that published bundle; must not be NULL.
bundle Bundle whose messages to receive; must not be NULL.
callback Called once per message; must not be NULL.
user_state Passed to callback.
token Required. Cancel it to stop the subscription; it also ends when the bundle is removed or the session closes.
- Returns
Success, QAR_STATUS_PANEL_CONTENT_NOT_PUBLISHER, or QAR_STATUS_PANEL_CONTENT_NOT_FOUND.
Definition at line 5612 of file qar_streaming.h.
Generated via doxygen2docusaurus 2.2.1 by Doxygen 1.9.8.