2021-05-15 15:48:47 +00:00
|
|
|
# Simple-SSE-Server
|
|
|
|
|
|
2021-05-18 15:42:01 +00:00
|
|
|
A simple SSE (Server Sent Event) Server written in Python
|
|
|
|
|
|
2021-05-18 15:47:41 +00:00
|
|
|
## Server
|
|
|
|
|
|
2021-05-18 15:42:01 +00:00
|
|
|
To test run
|
2021-05-18 15:44:40 +00:00
|
|
|
```
|
2021-05-18 15:42:01 +00:00
|
|
|
python3 SimpleSseSever.py
|
2021-05-18 15:44:40 +00:00
|
|
|
```
|
|
|
|
|
|
|
|
|
|
There is a requirements.txt, so you can install all dependicies:
|
|
|
|
|
```
|
|
|
|
|
pip install -r requirements.txt
|
|
|
|
|
```
|
2021-05-18 15:47:41 +00:00
|
|
|
|
|
|
|
|
## Browser
|
|
|
|
|
To check the connection in the browsser (Chrome, Firefox, etc.), you can open
|
|
|
|
|
```
|
|
|
|
|
http://127.0.0.1/stream
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
Ope the developer console, there you can register to the event
|
|
|
|
|
```
|
|
|
|
|
var src = new EventSource('http://127.0.0.1:5000/stream');
|
|
|
|
|
src.addEventListener("test", function(event) {
|
|
|
|
|
console.log(event)})
|
|
|
|
|
```
|