【问题标题】:What are Channel and Signature in the Push API?Push API 中的 Channel 和 Signature 是什么?
【发布时间】:2016-08-15 21:55:33
【问题描述】:

关于HTTP REST Push API,我的假设是我可以用我的一个pubnub 应用程序中的数据替换“发布测试”URL (http://pubsub.pubnub.com/publish/demo/demo/0/hello_world/0/%22Hello%20World%22) 并将其放入浏览器中。我这样做了,用我的 pub 和 sub 键替换了“演示”字符串。我收到带有唯一 ID 的“已发送”的 JSON 响应。但是,当我查看我在帐户中使用的演示密钥集时,它显示“0 条消息”。

  1. 什么是频道和签名(上面 URL 中的 0)?我需要它们吗?我在哪里可以得到它们?
  2. 上述测试是否会在我的演示密钥中注册消息计数?

【问题讨论】:

    标签: pubnub


    【解决方案1】:

    PubNub 管理仪表板使用情况

    使用量每 24 小时计算一次,并在太平洋时间上午 9 点左右发布到您的帐户。

    PubNub REST API

    对于发布 REST 调用,0 参数是 signaturecallback(不是您所指出的 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 年前被弃用,所以它应该始终是 0callback 只是应该为 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.
    

    【讨论】:

    • 很高兴知道。有没有办法确认它在没有订阅设置的情况下工作?这也仍然不能回答其他两个路径变量是什么。
    • 我确实确认我现在看到了“1 条消息”。
    • 感谢您的更新。 URI Parameters 表是从哪里来的,为什么不包括 signature
    猜你喜欢
    • 2012-04-29
    • 2018-11-30
    • 2010-09-30
    • 2014-06-02
    • 1970-01-01
    • 2014-03-07
    • 2020-08-08
    • 1970-01-01
    • 2017-06-13
    相关资源
    最近更新 更多