code: def publish(self):
          
  
          while True:
              event = yield from self.event_source.get()
              str_buffer = []
  
              if event == POISON_PILL:
                  return
  
              if isinstance(event, str):
                  str_buffer.append(event)
  
              elif event.type == EventTypes.BLOCK_VALID:
                  str_buffer = map(json.dumps, eventify_block(event.data))
  
              for str_item in str_buffer:
                  for _, websocket in self.subscribers.items():
                      yield from websocket.send_str(str_item)
docs: Publish new events to the subscribers.