| tabler_app {tabler} | R Documentation |
Run a Tabler Application
Description
Launches a self-contained web application using httpuv for HTTP and WebSocket transport.
Usage
tabler_app(
ui,
server,
host = "127.0.0.1",
port = 3000L,
launch.browser = interactive(),
check_credentials = NULL,
github_auth = NULL,
session_secret = Sys.getenv("TABLER_SESSION_SECRET", ""),
session_expires = 604800L,
login_title = "Sign in"
)
Arguments
ui |
The UI definition - typically a call to page().
|
server |
A function with signature function(input, output, session).
|
host |
Host to listen on (default "127.0.0.1").
|
port |
Port number (default 3000L).
|
launch.browser |
Open a browser automatically when in an interactive session. |
check_credentials |
Optional function(username, password) returning
TRUE/FALSE. When supplied, the app is gated behind a login
page: the HTML page, cached outputs, widgets, downloads, plots, and the
WebSocket connection are all withheld from a browser until it presents a
valid signed session cookie (set after a successful login). See
logout for ending a session from the server. Default
NULL disables the login gate entirely. Cannot be combined with
github_auth.
|
github_auth |
Optional list enabling GitHub OAuth login instead of the
username/password form. Must contain client_id and
client_secret from a GitHub OAuth App (register one at
https://github.com/settings/developers, setting the callback URL to
http://<host>:<port>/github/callback). Optionally include
org (restrict to members of that GitHub organisation - requires
read:org token scope) and/or allowedUsers (character vector
of permitted GitHub usernames). Cannot be combined with
check_credentials.
|
session_secret |
Secret key used to sign the session cookie. Defaults to
the TABLER_SESSION_SECRET environment variable; if unset, a random
secret is generated for the run (with a warning) and all sessions are
invalidated on restart. Used when either check_credentials or
github_auth is supplied.
|
session_expires |
How long, in seconds, a login should persist
(default 7 days). Use 0 for a browser-session-only cookie that
requires logging in again every time the browser is fully closed.
|
login_title |
Title shown on the login page and browser tab. |
Details
Protocol
The browser and server exchange plain JSON messages over a WebSocket at
/ws:
Browser → R:
{"type":"input","name":"<id>","value":<v>}R → Browser:
{"type":"output","id":"<id>","html":"<escaped HTML>"}
Reactive system
Uses tabler's own dependency-tracking reactive system (see reactive,
observe, reactive_val, observe_event).
Render functions (render_text, render_ui, render_print) are
assigned to output inside server.
Value
Invisibly, after the server is stopped.