class_docstr: Class to manage Server-Sent Events
class_docstr_tok: ["Class","to","manage","Server-Sent","Events"]
docstr: Send data using EventSource protocol # noqa: DAR101
  
          :param data: The data field for the message.
          :param event: The event's type. If this is specified, an event will be dispatched on the browser to the listener for the specified event name; the web site would use addEventListener() to listen for named events. The default event type is "message".
          :param id: The event ID to set the EventSource object's last event ID value to.
          :param retry: The reconnection time to use when attempting to send the event. [What code handles this?] This must be an integer, specifying the reconnection time in milliseconds. If a non-integer value is specified, the field is ignored.
          :param comment: A colon as the first character of a line is essence a comment, and is ignored. Usually used as a ping message to keep connecting. If set, this will be a comment message.
          :param sep: The separator between lines. Defaults to "
  ".
          
docstr_tok: ["Send","data","using","EventSource","protocol","#","noqa",":","DAR101",":","param","data",":","The","data","field","for","the","message",".",":","param","event",":","The","event","'s","type",".","If","this","is","specified",",","an","event","will","be","dispatched","on","the","browser","to","the","listener","for","the","specified","event","name",";","the","web","site","would","use","addEventListener","(",")","to","listen","for","named","events",".","The","default","event","type","is","``","message","''",".",":","param","id",":","The","event","ID","to","set","the","EventSource","object","'s","last","event","ID","value","to",".",":","param","retry",":","The","reconnection","time","to","use","when","attempting","to","send","the","event",".","[","What","code","handles","this","?","]","This","must","be","an","integer",",","specifying","the","reconnection","time","in","milliseconds",".","If","a","non-integer","value","is","specified",",","the","field","is","ignored",".",":","param","comment",":","A","colon","as","the","first","character","of","a","line","is","essence","a","comment",",","and","is","ignored",".","Usually","used","as","a","ping","message","to","keep","connecting",".","If","set",",","this","will","be","a","comment","message",".",":","param","sep",":","The","separator","between","lines",".","Defaults","to","``","''","."]
code: def __init__(
      self,
      data: Optional[Any] = None,
      *,
      event: Optional[str] = None,
      id: Optional[int] = None,
      retry: Optional[int] = None,
      comment: Optional[str] = None,
      sep: Optional[str] = None,
  ) -> None:
      """Send data using EventSource protocol # noqa: DAR101
  
      :param data: The data field for the message.
      :param event: The event's type. If this is specified, an event will be dispatched on the browser to the listener for the specified event name; the web site would use addEventListener() to listen for named events. The default event type is "message".
      :param id: The event ID to set the EventSource object's last event ID value to.
      :param retry: The reconnection time to use when attempting to send the event. [What code handles this?] This must be an integer, specifying the reconnection time in milliseconds. If a non-integer value is specified, the field is ignored.
      :param comment: A colon as the first character of a line is essence a comment, and is ignored. Usually used as a ping message to keep connecting. If set, this will be a comment message.
      :param sep: The separator between lines. Defaults to "\r\n".
      """
      self.data = data
      self.event = event
      self.id = id
      self.retry = retry
      self.comment = comment
      self.DEFAULT_SEPARATOR = "\r\n"
      self.LINE_SEP_EXPR = re.compile(r"\r\n|\r|\n")
      self._sep = sep if sep is not None else self.DEFAULT_SEPARATOR
  
imports: import enum
  import io
  import json
  import logging
  import re
  from datetime import datetime
  from functools import partial
  from typing import Any, AsyncIterable, Callable, Coroutine, Dict, Optional, Union
  import anyio
  from starlette.background import BackgroundTask
  from starlette.concurrency import iterate_in_threadpool
  from starlette.responses import Response
  from starlette.types import Receive, Scope, Send
label_desc: Use image node_id 1 to create a new ServerSentEvent object  with example: obj = ServerSentEvent(data)