title: Realtime plotting bokeh python Flask without server
body: <p>I would like to use bokeh inside a python flask web app. Unfortunately I am not able to run a realtime plot using the native bokeh server, because I have only on port available in my Bluemix application (limitation by Cloud Foundry), which is already used by the python flask app. Setup and architecture of Bluemix and Python flask is unfortunately not changeable. So I tried to have deeper look on how the interactions with <a href="http://bokeh.pydata.org/en/latest/docs/user_guide/interaction/callbacks.html#userguide-interaction-callbacks" rel="nofollow noreferrer">JavaScript Callbacks</a> are working. But I am struggling with the realization and I am not pretty sure if my idea is working. </p>
  
  <p>I define a scatter plot using the "normal" bokeh process:</p>
  
  <pre><code>output_file("callback.html")
  
  X = np.random.uniform(0, 100, 100)
  e = np.random.normal(0, 1, 100)
  Y = 10 + 20 * X + e
  
  source = ColumnDataSource(data=dict(x=X, y=Y))
  
  plot = Figure(plot_width=400, plot_height=400)
  plot.scatter('x', 'y', source=source, line_width=3, line_alpha=0.6)
  
  
  def callback(source=source, window=None):
      data = source.get('data')
      x, y = data['x'], data['y']
      x.append((random.uniform(0,1) * 10))
      y.append(10 + 20* random.normalvariate(0,1))
      source.trigger('change')
  
  layout = column(plot)
  
  show(layout)
  </code></pre>
  
  <p>I know that I am definitely missing an event, which calls the callback in periodic intervals, but I am not sure how to indicate that. The idea is that the plot should update itself built on a new datapoint, which is generated in the callback function in periodic intervals. </p>
  
  <p>I hope that there is a way as it is possible through the bokeh server, which I already get the code working. Thank you very much for you time, I will appreciate any answer, comment or suggestions what to do!</p>