Mercurial > code > home > repos > homeauto
view lib/twisted_sse_demo/api_example.py @ 1299:fa74a9c9f753
rm old golang server that made an rdf graph from inputs on rpi (goraptor & hwio)
Ignore-this: 9631ad748dccd16277c74ee602846add
darcs-hash:223083e3a057713de9856ce548eddd285c8f48fa
author | drewp <drewp@bigasterisk.com> |
---|---|
date | Sun, 21 Apr 2019 02:45:35 -0700 |
parents | ee168d55524a |
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)