gpt4 book ai didi

javascript - Python 中的 Pubnub 存在功能 (GAE)

转载 作者:太空宇宙 更新时间:2023-11-03 19:02:03 27 4
gpt4 key购买 nike

PubNub,它对于实时通信来说真的很棒。根据 pubnub 团队提供的文档,我已完成 subscribepublish 实例,其工作正常。

现在我想知道如何让特定用户在 Python(GAE)应用程序中使用 PubNub channel ,但我没有找到有关如何在服务器端和客户端实现此功能的完整指南。

注意:我在这里使用 Python Google App Engine 和 Javascript。

最佳答案

PubNub 存在是一种跟进 channel 中加入/离开的方法,如果我理解正确的话,您需要的是 here_now 功能,

取自 Pyton 库 ( https://github.com/pubnub/pubnub-api/tree/master/python/ )

here_now = pubnub.here_now({
'channel' : 'hello_world',
})

print(here_now['occupancy'])
print(here_now['uuids'])

现在您可以迭代 channel 中的任何人,但这无法在 javascript 中完成,因此您可能必须为每个真实 channel 设置另一个 channel ,您可以将信息从服务器端发送到客户端,然后相应地更新某些内容。

关于javascript - Python 中的 Pubnub 存在功能 (GAE),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15781842/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com