예제 #1
0
파일: api.py 프로젝트: zs1621/collipa
 def on_close(self):
     if self in WebSocketHandler.users:
         if self.current_user:
             WebSocketHandler.online.remove(self.user_id)
             rd.srem("online", self.user_id)
         WebSocketHandler.users.remove(self)
         self.on_message("offline")
예제 #2
0
파일: api.py 프로젝트: hallocrowc/collipa
 def on_close(self):
     if self in WebSocketHandler.users:
         if self.current_user:
             try:
                 WebSocketHandler.online.remove(self.user_id)
             except:
                 pass
             rd.srem("online", self.user_id)
         WebSocketHandler.users.remove(self)
         logging.info("%s offline" % self.user_id)
         WebSocketHandler.send_online()
예제 #3
0
파일: api.py 프로젝트: catsky/collipa
 def on_close(self):
     if self in WebSocketHandler.users:
         if self.current_user:
             try:
                 WebSocketHandler.online.remove(self.user_id)
             except:
                 pass
             rd.srem("online", self.user_id)
         WebSocketHandler.users.remove(self)
         logging.info("%s offline" % self.user_id)
         WebSocketHandler.send_online()
예제 #4
0
파일: api.py 프로젝트: SunnyKale/collipa
 def send_online(cls):
     online = rd.smembers("online")
     logging.info("Online user count is " + unicode(len(online)))
     for user in cls.users:
         try:
             user.write_message({"type": "online", "count": unicode(len(online))})
         except Exception as e:
             logging.error("Error sending online user count", exc_info=True)
             if type(e).__name__ == "AttributeError":
                 try:
                     WebSocketHandler.users.remove(user)
                     rd.srem("online", user.user_id)
                     WebSocketHandler.online.remove(user.user_id)
                 except:
                     pass
예제 #5
0
파일: api.py 프로젝트: catsky/collipa
 def send_online(cls):
     online = rd.smembers("online")
     logging.info("Online user count is " + unicode(len(online)))
     for user in cls.users:
         try:
             user.write_message({
                 "type": "online",
                 "count": unicode(len(online))
             })
         except Exception as e:
             logging.error("Error sending online user count", exc_info=True)
             if type(e).__name__ == "AttributeError":
                 try:
                     WebSocketHandler.users.remove(user)
                     rd.srem("online", user.user_id)
                     WebSocketHandler.online.remove(user.user_id)
                 except:
                     pass