def initialize(self, *args, **kwargs):
try:
if self.request.user and self.request.user.is_active:
_connections.append(self)
self.lift_acl_restrictions()
else:
return
except Exception, e:
logger.error("Error initialize socket - "+str(e))
- Override disconnect function to remove connections from array:
def disconnect(self, *args, **kwargs):
try:
_connections.remove(self)
super(NotificacoesNamespace, self).disconnect(*args, **kwargs)
except Exception, e:
logger.error("Error disconnect socket - "+str(e))
I don't know if I'm following the best practices, but it's working.
Hope it helps.