{%if this.isStreaming%}
from ipykernel.comm import Comm
from pixiedust.display.streamingDisplay import *
cellId = "{{this.options["cell_id"]}}"
entity = activesStreamingEntities[cellId] if cellId in activesStreamingEntities else None
if entity is not None:
comms = Comm(target_name="{{this.commId}}", data={}) if not hasattr(entity, "comms") else entity.comms
entity.comms = comms
metadata = entity.getMetadata();
comms.send({
"data": entity.getNextData(),
"type": metadata.get("type", "circle"),
"layout": metadata.get("layout", {}),
"paint": metadata.get("paint", {}),
"fitbounds": metadata.get("fitbounds", True)
})
{%endif%}