code: def stream():
      def event_stream():
          """No global state used"""
          while True:
              t = datetime.now().timestamp()
              v = np.sin(t * 5) + 0.2 * np.random.random() + 3
              x = v * np.sin(t)
              y = v * np.cos(t)
              data = [[x, y]]
              yield "data: " + json.dumps(data) + "\n\n"
              sleep(0.1)
  
      resp = Response(event_stream(), mimetype="text/event-stream")
      resp.headers["Cache-Control"] = "no-cache"
      return resp
  
file_path: bokeh/examples/basic/data/server_sent_events_source.py
imports: import json
  from datetime import datetime
  from time import sleep
  import numpy
  from flask import Flask, Response, make_response, request
  from bokeh.models import CustomJS, ServerSentDataSource
  from bokeh.plotting import figure, show
label_desc: Use image node_id 2 for calling a global function with example usage: stream() and returns: resp