在参考HTTP REST Push API时,我的假设是我可以用我的某个pubnub应用程序中的数据替换“发布测试”URL(http://pubsub.pubnub.com/publish/demo/demo/0/hello_world/0/%22Hello%20World%22)并将其放入浏览器中。我做了这个,用我的pub和子键替换了“demo”字符串。我收到了一个带有唯一ID的“已发送”的JSON响应。但是,当我查看我在帐户中使用的演示密钥集时,它会显示“0消息”。
答案 0 :(得分:2)
使用情况每24小时计算一次,并在太平洋时间早上9点左右发布到您的帐户。
对于发布REST调用,0
参数为signature
和callback
(不是channel
,如您所示 - 假设您的意思是callback
, ):
http://pubsub.pubnub.com/publish
/pub-key
/sub-key
/signature
/channel
/callback
/message
提供的示例(显示给其他人):
http://pubsub.pubnub.com
/publish
/demo
/demo
/0
/hello_world
/0
/%22Hello%20World%22
signature
(第一个0
)已在3年前弃用,因此应始终为0
。 callback
只是应该为publish
响应调用的函数的名称。 PubNub SDK使用此功能,因此0
适用于大多数非SDK用例。
以下是更详细的publish
REST文档:
https://pubsub.pubnub.com/publish/{pub_key}/{sub_key}/0/{channel}/{callback}/{payload}{?store}
URI参数
Name Type Required Description
pub_key string Yes your publish key
sub_key string Yes your subscribe key
channel string Yes channel to publish the message to
callback string Yes response will be wrapped in JSONP function, 0 for no JSONP
payload string Yes message to send (url-encoded JSON)
store number No overrides default account configuration on message saving. store: 1, do not store: 0
auth string No if the channel is protected by Access Manager (requires a permissions to be granted), auth must be passed with an auth-key which is authorized to write to the channel.