code: def store_groups_in_session(sender, user, request, **kwargs):
      
      if hasattr(user, 'groups'):
          request.session['ws4redis:memberof'] = [g.name for g in user.groups.all()]
docs: When a user logs in, fetch its groups and store them in the users session.
      This is required by ws4redis, since fetching groups accesses the database, which is a blocking
      operation and thus not allowed from within the websocket loop.