本文整理汇总了Python中Pubnub.Pubnub.start方法的典型用法代码示例。如果您正苦于以下问题:Python Pubnub.start方法的具体用法?Python Pubnub.start怎么用?Python Pubnub.start使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Pubnub.Pubnub
的用法示例。
在下文中一共展示了Pubnub.start方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: subscribe_cb
# 需要导入模块: from Pubnub import Pubnub [as 别名]
# 或者: from Pubnub.Pubnub import start [as 别名]
pubnub.publish({
'channel': channel,
'message': message,
'callback': publish_cb
})
time.sleep(5)
pubnub.here_now({
'channel': channel,
'callback': here_now_cb
})
def subscribe_cb(response):
test(response == message,
'Here Now Test: Subscribe Receive Test in subscribe Callback')
pubnub.subscribe({
'channel': channel,
'connect': subscribe_connect_cb,
'callback': subscribe_cb
})
expect = 7
test_publish()
test_history()
test_subscribe()
test_here_now()
pubnub.start()
if failures > 0:
raise Exception('Fail', failures)
示例2: dumpster
# 需要导入模块: from Pubnub import Pubnub [as 别名]
# 或者: from Pubnub.Pubnub import start [as 别名]
def dumpster(message) :
test( 0, 'never see this' )
pubnub.subscribe({
'channel' : crazy,
'connect' : done,
'callback' : dumpster
})
def connected() :
pubnub.publish({
'channel' : crazy,
'message' : { 'Info' : 'Connected!' }
})
pubnub.subscribe({
'channel' : crazy,
'connect' : connected,
'callback' : message_received
})
phase2()
## -----------------------------------------------------------------------
## Run Tests
## -----------------------------------------------------------------------
test_pubnub(pubnub_user_supplied_options)
test_pubnub(pubnub_high_security)
pubnub_high_security.start()