本文整理汇总了Python中pubnub.pubnub_asyncio.PubNubAsyncio.where_now方法的典型用法代码示例。如果您正苦于以下问题:Python PubNubAsyncio.where_now方法的具体用法?Python PubNubAsyncio.where_now怎么用?Python PubNubAsyncio.where_now使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pubnub.pubnub_asyncio.PubNubAsyncio
的用法示例。
在下文中一共展示了PubNubAsyncio.where_now方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_multiple_channels
# 需要导入模块: from pubnub.pubnub_asyncio import PubNubAsyncio [as 别名]
# 或者: from pubnub.pubnub_asyncio.PubNubAsyncio import where_now [as 别名]
def test_multiple_channels(event_loop, sleeper=asyncio.sleep):
pubnub = PubNubAsyncio(pnconf_sub_copy(), custom_event_loop=event_loop)
ch1 = 'test-where-now-asyncio-ch1'
ch2 = 'test-where-now-asyncio-ch2'
uuid = 'test-where-now-asyncio-uuid'
pubnub.config.uuid = uuid
callback = VCR599Listener(1)
pubnub.add_listener(callback)
pubnub.subscribe().channels([ch1, ch2]).execute()
yield from callback.wait_for_connect()
yield from sleeper(7)
env = yield from pubnub.where_now() \
.uuid(uuid) \
.future()
channels = env.result.channels
assert len(channels) == 2
assert ch1 in channels
assert ch2 in channels
pubnub.unsubscribe().channels([ch1, ch2]).execute()
yield from callback.wait_for_disconnect()
pubnub.stop()
示例2: test_where_now_super_admin_call
# 需要导入模块: from pubnub.pubnub_asyncio import PubNubAsyncio [as 别名]
# 或者: from pubnub.pubnub_asyncio.PubNubAsyncio import where_now [as 别名]
def test_where_now_super_admin_call(event_loop):
pubnub = PubNubAsyncio(pnconf_pam_copy(), custom_event_loop=event_loop)
uuid = 'test-where-now-asyncio-uuid'
pubnub.config.uuid = uuid
res = yield from pubnub.where_now() \
.uuid(uuid) \
.result()
assert isinstance(res, PNWhereNowResult)
pubnub.stop()