【问题标题】:Pubnub Presence feature in Python (GAE)Python (GAE) 中的 Pubnub Presence 功能
【发布时间】:2013-04-03 07:57:14
【问题描述】:

PubNub,它非常适合实时通信。根据 pubnub 团队提供的文档,我已经完成了 subscribepublish 实例,它工作正常。

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

注意:这里使用的是 Python Google App Engine 和 Javascript。

【问题讨论】:

标签: javascript python google-app-engine pubnub user-presence


【解决方案1】:

PubNub 存在是一种跟踪频道中加入/离开的方式,如果我理解正确,您需要的是 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'])

现在您可以对频道中的任何人进行迭代, 这不能在 javascript 中完成,因此您可能必须为每个真实频道设置另一个频道,您可以将信息从服务器端发送到客户端,然后相应地进行更新。

【讨论】:

  • 我也试过这个..但我得到的here_nowNone。虽然我已经发布了一个频道。
  • 现在我收到了一条消息{u'error': u'Presence is not enabled for this subscribe key. Contact support@pubnub.com to activate this feature.'}
  • Pubnub 即使是开发环境也需要激活,你应该联系他们:-)
  • 哇..!!是付费激活吗? ;)
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2019-08-06
  • 1970-01-01
  • 1970-01-01
  • 2021-08-08
  • 1970-01-01
  • 2017-11-26
  • 1970-01-01
相关资源
最近更新 更多