Pubnub Presence feature in Python (GAE)

╄→гoц情女王★ 提交于 2019-12-08 06:35:55

问题


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.


回答1:


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.



来源:https://stackoverflow.com/questions/15781842/pubnub-presence-feature-in-python-gae

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!