code: def sse(self, request):
          
          response = Response(status=200)
          response.content_type = 'text/event-stream'
          response.text = ''
          active_request_id = request.GET.get('request_id')
          client_last_request_id = str(request.headers.get('Last-Event-Id', 0))
          if self.history:
              last_request_id = next(reversed(self.history))
              if not last_request_id == client_last_request_id:
                  data = []
                  for _id in reversed(self.history):
                      data.append([
                          _id, self.history[_id].json, 'active' if active_request_id == _id else ''])
                  if data:
                      response.text = U_SSE_PAYLOAD.format(last_request_id, json.dumps(data))
  
          return response
docs: SSE.