Mercurial > code > home > repos > homeauto
comparison lib/twisted_sse_demo/api_example.py @ 351:7716b1810d6c
reasoning & collector move into docker images
Ignore-this: 67e97d307eba96791cbe77e57c57ad57
author | drewp@bigasterisk.com |
---|---|
date | Mon, 03 Sep 2018 00:45:34 -0700 |
parents | service/reasoning/twisted_sse_demo/api_example.py@14ac4a210dbc |
children |
comparison
equal
deleted
inserted
replaced
350:a380561fd8a8 | 351:7716b1810d6c |
---|---|
1 import time | |
2 | |
3 from eventsource import EventSource | |
4 | |
5 EVENTSOURCE_URL = 'http://localhost:12000/subscribe' | |
6 | |
7 def onmessage(data): | |
8 print 'Got payload with data %s' % data | |
9 | |
10 if __name__ == '__main__': | |
11 eventSource = EventSource(EVENTSOURCE_URL) | |
12 eventSource.onmessage(onmessage, callInThread=True) | |
13 time.sleep(20) |