You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Refer to the [server-sent events example](https://github.com/Neoteroi/BlackSheep-Examples/tree/main/server-sent-events) for an example that handles application shutdown and client
203
203
disconnections, and also presents a basic example in JavaScript to use SSE.
204
204
205
+
## Using SSE in older versions of BlackSheep
206
+
207
+
The following example illustrates how to use server-sent events in older
208
+
versions of the web framework.
209
+
210
+
```python
211
+
212
+
import asyncio
213
+
import json
214
+
from blacksheep import Application, Response, StreamedContent, get
215
+
216
+
app = Application()
217
+
218
+
219
+
@get("/events")
220
+
defevents_handler(request):
221
+
asyncdefprovider():
222
+
i =0
223
+
whileTrue:
224
+
#TODO: implement way to detect if the process is stopping,
225
+
# and if the request is still active,
226
+
# use await request.is_disconnected() if available...
0 commit comments