% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/stream.R
\name{stream_init}
\alias{stream_init}
\title{Initialize the shidashi stream directory for a Shiny session}
\usage{
stream_init(session = shiny::getDefaultReactiveDomain())
}
\arguments{
\item{session}{Shiny session object.  Defaults to the currently active
reactive domain.}
}
\value{
Invisibly returns the absolute path to the stream directory.
}
\description{
Call once in the server function to set up the directory that
\code{\link{stream_path}} and \code{\link{stream_to_js}} will write to.
When running inside a shidashi template the directory is automatically
resolved from the template root; when running in plain Shiny a temporary
directory is created and registered with
\code{\link[shiny]{addResourcePath}} so that the browser can fetch
\code{stream/{token}_{id}.bin}.  An optional cleanup hook is registered
to remove this session's files when the session ends.
}
\seealso{
\code{\link{stream_path}}, \code{\link{stream_to_js}}
}
