From c2a9ebdf1f22eda2988a10752312befc793b7751 Mon Sep 17 00:00:00 2001 From: Jesus Chacon Date: Tue, 12 Nov 2019 19:39:33 +0100 Subject: [PATCH] SSE only accept clients when the expId is correct. --- HttpServer.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/HttpServer.py b/HttpServer.py index b94ab0f0..fde2cf45 100644 --- a/HttpServer.py +++ b/HttpServer.py @@ -48,9 +48,12 @@ def SSE(self, expId=None): cherrypy.response.headers['Cache-Control'] = 'no-cache' cherrypy.response.headers['Connection'] = 'keep-alive' # TO DO: stop when all clients are disconnected - if not self.control.running: - self.control.start() - return self.control.nextSample() + if expId is not None: + if expId in [e['id'] for e in self.experiences]: + if not self.control.running: + self.control.start() + return self.control.nextSample() + return 'event: CLOSE\n\n' SSE._cp_config = {'response.stream': True} @cherrypy.expose