changeset 1118:ae6b5604950d

new / page Ignore-this: 1319a063da131f3a20e4ea3ded935a99 darcs-hash:7f217dd50d7a19de1e726a6c4820abc35c6f9750
author drewp <drewp@bigasterisk.com>
date Sun, 09 Oct 2016 13:58:51 -0700
parents d5687ba23279
children 98aad873874d
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),
             ],