title: How to read from stdin in Shiny?
body: <p>I can read from stdin in an R script:</p>
  
  <pre><code>$ echo "some text" | Rscript script.R
  </code></pre>
  
  <p>Note: using Docker and the <a href="https://hub.docker.com/r/rocker/r-base/" rel="nofollow noreferrer"><code>rocker/r-base</code></a> image you can run:</p>
  
  <pre><code>$ echo "some text" | docker run --rm -i \
      -v $(pwd):/usr/src/app rocker/r-base \
      bash -c 'Rscript /usr/src/app/script.R'
  </code></pre>
  
  <p><strong>sript.R</strong>:</p>
  
  <pre><code>f &lt;- file("stdin")
  i &lt;- readLines(f)
  close(f)
  cat(i)
  </code></pre>
  
  <p>Now I want to reproduce this behaviour in shiny:</p>
  
  <pre><code>$ echo "some text" | shiny-server
  </code></pre>
  
  <p>Note: or with docker using <a href="https://hub.docker.com/r/rocker/shiny/" rel="nofollow noreferrer"><code>rocker/shiny</code></a>:</p>
  
  <pre><code>$ docker run --rm -it -p 80:3838 -v $(pwd):/srv/shiny-server/ rocker/shiny bash
  # and then run in the container
  $ echo "some text" | shiny-server
  </code></pre>
  
  <p><strong>app.R</strong>:</p>
  
  <pre><code>library(shiny)
  ui &lt;- pageWithSidebar(
      headerPanel("example"),
      sidebarPanel(),
      mainPanel(textOutput("my_stdin"))
  )
  
  server &lt;- function(input, output, session) {
      output$my_stdin &lt;- renderText({
          f &lt;- file("stdin")
          i &lt;- readLines(f)
          close(f)
          i
      })
  }
  shinyApp(ui, server)
  </code></pre>
  
  <p>Why is there no output from shiny?</p>
  
  <p>The actual szenario is reading streaming data from <code>$ nc -u -l 1.2.3.4 1234</code> but the simple example above also illustrates my problem.</p>