subhrajit-mohanty commited on
Commit
865a893
·
verified ·
1 Parent(s): b17d955

Create services.py

Browse files
Files changed (1) hide show
  1. services.py +11 -0
services.py ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import asyncio
2
+ import json
3
+
4
+
5
+ async def event_generator():
6
+ counter = 0
7
+ while True:
8
+ data = {"message": f"Ping {counter}"}
9
+ yield f"data: {json.dumps(data)}\n\n"
10
+ counter += 1
11
+ await asyncio.sleep(1)