MCPcopy
hub / github.com/sparckles/Robyn / json_event_generator

Function json_event_generator

examples/sse_example.py:76–81  ·  view source on GitHub ↗

Generator that yields JSON data as SSE

()

Source from the content-addressed store, hash-verified

74 import json
75
76 def json_event_generator():
77 """Generator that yields JSON data as SSE"""
78 for i in range(5):
79 data = {"id": i, "message": f"JSON message {i}", "timestamp": time.time(), "type": "notification"}
80 yield SSEMessage(json.dumps(data), event="notification", id=str(i))
81 time.sleep(2)
82
83 return SSEResponse(json_event_generator())
84

Callers 1

stream_json_eventsFunction · 0.85

Calls 2

SSEMessageFunction · 0.90
dumpsMethod · 0.80

Tested by

no test coverage detected