Python中的Pubnub Presence功能(GAE) [英] Pubnub Presence feature in Python (GAE)

查看:231
本文介绍了Python中的Pubnub Presence功能(GAE)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

PubNub,它非常适合实时通信。根据pubnub团队给出的文档,我完成了订阅发布实例,它的工作正常。



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



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

解决方案

PubNub存在是跟踪频道中连接/离开的一种方式,您需要的是here_now功能如果我理解正确,

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



<$ p $ ($ _ $ b'channel':'hello_world',
})

print(here_now ['occupancy'])

here_now = pubnub.here_now
print(here_now ['uuids'])

现在您可以迭代在现在的频道中,
不能在javascript中完成,但是您必须为每个真实频道设置另一个频道,以便将信息从服务器端发送到客户端一边,然后相应地更新。


PubNub, its really awesome for real-time communication. as per as documention given by pubnub team, am done with subscribe and publish instance, its working fine.

Now am wondering how get a particular user already/presence with PubNub channels in Python(GAE) apps, but I didn't find a complete guide to how to implement this feature in both server and client side.

NOTE: am using here Python Google App Engine & Javascript.

解决方案

PubNub presence is a way to follow up on joins/leaves in a channel, what you need is the here_now feature if I understand correctly,

Taken from the Pyton lib is (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'])

And now you can iterate on whoever is in the channel right now, this can't be done in the javascript though so you'd have to have perhaps another channel for each of your real channels that you can send the information from the server-side to the client side and then update something accordingly.

这篇关于Python中的Pubnub Presence功能(GAE)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆