From d954ed175de1dab5bda8c198bc8d7e0b2c552d01 Mon Sep 17 00:00:00 2001 From: Jan Tuomi Date: Mon, 18 Jul 2016 19:20:19 +0300 Subject: Add buffer to avoid forwarding duplicate messages from shoutbox --- jsonfactory.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'jsonfactory.py') diff --git a/jsonfactory.py b/jsonfactory.py index be70996..6703ef2 100644 --- a/jsonfactory.py +++ b/jsonfactory.py @@ -2,15 +2,18 @@ import json class JSONFactory(object): + running_id = 1 + @staticmethod def make_object(text, user, timestamp, ip): message = json.dumps({ + "id": JSONFactory.running_id, "text": text, "user": user, "timestamp": timestamp, "ip": ip }) - + JSONFactory.running_id += 1 return message @staticmethod -- cgit v1.3