简体   繁体   中英

Pubnub Presence feature in Python (GAE)

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM