view lib/twisted_sse_demo/api_example.py @ 1234:c02ac623e593

animated rgb puts more data back into graph Ignore-this: d3ba1aa218aa1782aa715d5cd013bb9 darcs-hash:c4b0603e41006cb77224ee3adc7e79d1e3a6a6d6
author drewp <drewp@bigasterisk.com>
date Sun, 07 Apr 2019 03:58:05 -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)