Example #1
0
File: ws.py Project: dqbd/cheap-pos
 def run(self):
     self.sock.setblocking(True)
     with Heartbeat(self, frequency=self.heartbeat_freq):
         s = self.stream
         try:
             self.opened()
             while not self.terminated:
                 if not self._input.empty():
                     item = self._input.get()
                     self.send(item)
                 if not self.once():
                     print("Breaking")
                     break
         finally:
             print("terminating")
             self.terminate()
Example #2
0
    def _keep_alive(self):
        '''Send a keep-alive packet to Firebase'''

        Timer(10.0, lambda: Heartbeat(self.connection.data, 2).start()).start()