Description Super class Public fields Active bindings Methods
Modified fiery::Fire
class definition that includes some improvements:
Takes advantage of httpuv::staticPath()
to serve static assets,
which "happens entirely within the I/O thread, so doing so will not
block or be blocked by activity in the main R thread."
Incorporates the routr
package for routing, instead of relying on the
user to create it separately.
fiery::Fire
-> Fire
path_extractor
function that transforms websocket to a path
url
Application URL
data
read application data
routers
read-only list of routers
handles
read-only list of handlers
statics
read-only list of statics
events
helpful guide to function arguments
sockets
read-only list of active websockets
trigger()
Triggers an event
Fire$trigger(event, ..., check = TRUE)
event
(str) event name
...
(arg) args passed to handler
check
(flg) check whether this is protected
on_router()
Add a route
Fire$on_router( path, handler, ..., name = path, methods = "get", attach = c("request", "message", "header"), priority = 0L, replace = FALSE )
path
(str) endpoint
handler
(fun) handler; must have arguments
request
, response
, keys
, ...
.
...
(dta) extra metadata to identify this route.
name
(str) human-readable friendly name
methods
(chr) combination of GET, POST, PUT, PATCH, DELETE
attach
(str) event to attach. defaults to request
.
priority
(int) relative positioning of the handler; lower will be executed first.
replace
(flg) whether or not to replace same name or error out
off_router()
Remove a route
Fire$off_router(name, attach = c("request", "message", "header"))
name
(str) human-readable friendly name
attach
(str) event to attach. defaults to request
.
on_static()
Add a static handler
Fire$on_static( path, file, name = path, index_html = TRUE, fallthrough = FALSE, html_charset = "utf-8", headers = list(), validation = character(0), replace = FALSE )
path
(url) URL path to serve
file
(pth) directory to serve on that path
name
(str) human-readable friendly name
index_html
(flg) whether or not to serve when index.html exists
fallthrough
(flg) if not available, use R callback
html_charset
(str) html charset, defaults to UTF-8
headers
(lst) headers that are included with the response
validation
(chr) character vector of headers needed
replace
(flg) if already exists, overwrite
...
(dta) extra metadata to identify this static path.
off_static()
Remove a static handler
Fire$off_static(name)
name
(str) human-readable friendly name
build_routers()
Builds the route stack and attaches it as a plugin
Fire$build_routers(..., force = TRUE)
...
(arg) extra arguments
force
(flg) force the attachment of the routes
attach()
This is a modified version of attach that returns the handler IDs associated, so that they can be removed later on.
Fire$attach(plugin, ..., force = FALSE)
plugin
(ApplicationPlugin) to attach
...
(arg) passed to the plugin's on_attach()
method
force
(flg) force attaching the plugin
detach()
Detaches a plugin
Fire$detach(name)
name
(str) name of the plugin
detach_all()
Detaches all plugins
Fire$detach_all()
browse()
Browse to the App URL
Fire$browse()
clear_data()
Clear all data
Fire$clear_data()
clone()
The objects of this class are cloneable with this method.
Fire$clone(deep = FALSE)
deep
Whether to make a deep clone.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.