本文整理汇总了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)
示例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)
示例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)
示例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)
示例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)
示例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)
示例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)})