Spaces:
Build error
Build error
changges
Browse files- client/src/main.py +4 -0
- display/index.html +2 -4
client/src/main.py
CHANGED
@@ -114,7 +114,11 @@ async def sse(request):
|
|
114 |
generator = numbers(1, 5)
|
115 |
return EventSourceResponse(generator)
|
116 |
|
|
|
|
|
|
|
117 |
routes = [
|
|
|
118 |
Route("/test", endpoint=sse)
|
119 |
]
|
120 |
|
|
|
114 |
generator = numbers(1, 5)
|
115 |
return EventSourceResponse(generator)
|
116 |
|
117 |
+
def test(request):
|
118 |
+
return "hello world"
|
119 |
+
|
120 |
routes = [
|
121 |
+
Route('/', endpoint=test),
|
122 |
Route("/test", endpoint=sse)
|
123 |
]
|
124 |
|
display/index.html
CHANGED
@@ -11,10 +11,8 @@
|
|
11 |
<script>
|
12 |
window.onload = () => {
|
13 |
const eventSource = new EventSource('http://127.0.0.1:5555/test');
|
14 |
-
|
15 |
-
console.log(
|
16 |
-
const data = JSON.parse(event.data);
|
17 |
-
document.body.innerHTML = data.text;
|
18 |
};
|
19 |
}
|
20 |
</script>
|
|
|
11 |
<script>
|
12 |
window.onload = () => {
|
13 |
const eventSource = new EventSource('http://127.0.0.1:5555/test');
|
14 |
+
evtSource.onmessage = (e) => {
|
15 |
+
console.log(e.data);
|
|
|
|
|
16 |
};
|
17 |
}
|
18 |
</script>
|