当前位置: 首页>>代码示例>>Python>>正文


Python Group.discard方法代码示例

本文整理汇总了Python中channels.Group.discard方法的典型用法代码示例。如果您正苦于以下问题:Python Group.discard方法的具体用法?Python Group.discard怎么用?Python Group.discard使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在channels.Group的用法示例。


在下文中一共展示了Group.discard方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: ws_disconnect

# 需要导入模块: from channels import Group [as 别名]
# 或者: from channels.Group import discard [as 别名]
def ws_disconnect(message):
    """
    Channels connection close.
    Deregister the client
    """
    language = message.channel_session['knocker']
    gr = Group('knocker-{0}'.format(language))
    gr.discard(message.reply_channel)
开发者ID:adamchainz,项目名称:django-knocker,代码行数:10,代码来源:consumers.py

示例2: disconnect_wait_page

# 需要导入模块: from channels import Group [as 别名]
# 或者: from channels.Group import discard [as 别名]
def disconnect_wait_page(message, params):
    app_label, page_index, model_name, model_pk = params.split(',')
    page_index = int(page_index)
    model_pk = int(model_pk)

    group_name = channels_wait_page_group_name(
        app_label, page_index, model_name, model_pk
    )
    group = Group(group_name)
    group.discard(message.reply_channel)
开发者ID:jpg75,项目名称:otree-core,代码行数:12,代码来源:consumers.py

示例3: disconnect_auto_advance

# 需要导入模块: from channels import Group [as 别名]
# 或者: from channels.Group import discard [as 别名]
def disconnect_auto_advance(message, params):
    participant_code, page_index = params.split(',')

    group = Group('auto-advance-{}'.format(participant_code))
    group.discard(message.reply_channel)
开发者ID:jpg75,项目名称:otree-core,代码行数:7,代码来源:consumers.py

示例4: disconnect_wait_for_session

# 需要导入模块: from channels import Group [as 别名]
# 或者: from channels.Group import discard [as 别名]
def disconnect_wait_for_session(message, pre_create_id):
    group = Group(
        channels_create_session_group_name(pre_create_id)
    )
    group.discard(message.reply_channel)
开发者ID:jpg75,项目名称:otree-core,代码行数:7,代码来源:consumers.py

示例5: disconnect

# 需要导入模块: from channels import Group [as 别名]
# 或者: from channels.Group import discard [as 别名]
 def disconnect(self, request, *args, **kwargs):
     band_id = kwargs.get("band_id")
     group = Group(self.CHAT_GROUP_TEMPLATE % band_id)
     group.discard(request.reply_channel)
开发者ID:YetAnotherTeam,项目名称:jatumba-backend,代码行数:6,代码来源:web_socket.py

示例6: chat_disconnect

# 需要导入模块: from channels import Group [as 别名]
# 或者: from channels.Group import discard [as 别名]
def chat_disconnect(message):
    room = message.channel_session['room']

    group = Group('chat-%s' % room)
    group.discard(message.reply_channel)
开发者ID:bionikspoon,项目名称:django_channels_chat,代码行数:7,代码来源:consumers.py

示例7: ws_disconnect

# 需要导入模块: from channels import Group [as 别名]
# 或者: from channels.Group import discard [as 别名]
def ws_disconnect(message, room):
    g = Group('chat:{}'.format(room))
    g.discard(message.reply_channel)
    data = {'text': 'A user disconnected', 'type': 'log'}
    g.send({'text': json.dumps(data)})
开发者ID:mediainteractiva,项目名称:chan,代码行数:7,代码来源:consumers.py


注:本文中的channels.Group.discard方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。