send out keep alive
authorPaul van der Linden <mail@paultjuh.org>
Mon, 16 Feb 2015 20:59:20 +0000 (20:59 +0000)
committerPaul van der Linden <mail@paultjuh.org>
Mon, 16 Feb 2015 20:59:20 +0000 (20:59 +0000)
tweepy/streaming.py

index 956f29bc14b028709a6c012f51a248d1fe79bd00..677e3f6fad711665883d408b51ca844b8d2517fe 100644 (file)
@@ -79,6 +79,10 @@ class StreamListener(object):
         else:
             logging.error("Unknown message type: " + str(raw_data))
 
+    def keep_alive(self):
+        """Called when a keep-alive arrived"""
+        return
+
     def on_status(self, status):
         """Called when a new status arrives"""
         return
@@ -293,7 +297,7 @@ class Stream(object):
             while True:
                 line = buf.read_line().strip()
                 if not line:
-                    pass  # keep-alive new lines are expected
+                    self.listener.keep_alive()  # keep-alive new lines are expected
                 elif line.isdigit():
                     length = int(line)
                     break