Mercurial > code > home > repos > homeauto
view lib/twisted_sse/api_example.py @ 510:b1337ad3ec2d
mv twisted_sse
Ignore-this: a59fadbe80bc4a393b1dab8228e022c1
author | drewp@bigasterisk.com |
---|---|
date | Mon, 22 Apr 2019 21:58:09 -0700 |
parents | lib/twisted_sse_demo/api_example.py@7716b1810d6c |
children |
line wrap: on
line source
import time from eventsource import EventSource EVENTSOURCE_URL = 'http://localhost:12000/subscribe' def onmessage(data): print('Got payload with data %s' % data) if __name__ == '__main__': eventSource = EventSource(EVENTSOURCE_URL) eventSource.onmessage(onmessage, callInThread=True) time.sleep(20)