changeset 313:bfc3f246e77e

new / page Ignore-this: 1319a063da131f3a20e4ea3ded935a99
author drewp@bigasterisk.com
date Sun, 09 Oct 2016 13:58:51 -0700
parents 170dc9b1e789
children c51075f267bc
files service/reasoning/sse_collector.py
diffstat 1 files changed, 10 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/service/reasoning/sse_collector.py	Sun Oct 09 13:57:50 2016 -0700
+++ b/service/reasoning/sse_collector.py	Sun Oct 09 13:58:51 2016 -0700
@@ -278,9 +278,13 @@
                 
     def addSseHandler(self, handler):
         log.info('addSseHandler %r %r', handler, handler.streamId)
+
+        # fail early if id doesn't match
+        sources = self._sourcesForHandler(handler)
+
         self.handlers.add(handler)
         
-        for source in self._sourcesForHandler(handler):
+        for source in sources:
             if source not in self.clients and source != COLLECTOR:
                 self._localStatements.setSourceState(source, ROOM['connect'])
                 self.clients[source] = ReconnectingPatchSource(
@@ -354,6 +358,10 @@
             raise
         
         self.write(json.dumps({'graphClients': stats}, indent=2))
+
+class Root(cyclone.web.RequestHandler):
+    def get(self):
+        self.write('<html><body>sse_collector</body></html>')
         
 if __name__ == '__main__':
 
@@ -375,6 +383,7 @@
         9072,
         cyclone.web.Application(
             handlers=[
+                (r'/', Root),
                 (r'/stats', Stats),
                 (r'/graph/(.*)', SomeGraph),
             ],