PubNub 发布不起作用 [英] PubNub publish not working

查看:51
本文介绍了PubNub 发布不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将 PubNub 与 KaaIoT 平台集成,其中发布 API 引发以下错误/异常:

I am trying to integrate PubNub with KaaIoT platform where the publish API is throwing the following error/exception:

以下是显示我尝试发布的示例消息的代码:

Following is the code showing a sample message that I am trying to publish:

PNConfiguration pnConfiguration = new PNConfiguration();
        pnConfiguration.setSubscribeKey("sub-c-7c052466-04ea-11e5-aefa-0619f8945XXX");
        pnConfiguration.setPublishKey("pub-c-12a0e504-b46c-4c9c-ba5d-089ae589bYYY");

        PubNub pubNub = new PubNub(pnConfiguration);

        try {
            HashMap<String, String> data = new HashMap<String, String>();
            data.put("value", "39");
            data.put("since", "07:00 AM");

            pubNub.publish()
                    .message(data)
                    .channel("TEMP")
                    .sync();

            System.exit(0);

        } catch(Exception ex) {
            System.out.println("Got PubNubException..." + ex.toString());
            throw ex;
        }

如果我将上面的示例代码作为独立应用程序尝试,它运行良好.但是,在 kaaiot 内部,它不起作用.而且,我无法从日志中了解很多信息.

If I try this above sample code as a standalone application, it is working fine. However, inside kaaiot, it is not working. And, I am not able to make out much from the log.

知道什么可能导致同步方法失败吗?

Any idea what might be causing the sync method to fail?

推荐答案

你能调用任何其他基于休息的端点吗?SDK 正在幕后进行休息调用.该日志虽然信息量不大,但似乎指出无法进行休息.

Can you call any other rest based endpoint? The SDK is making rest calls under the covers. The log, although not very informative, seems to point to not being able to make a rest call.

它也可能是 kaaiot,它们允许通用的 http 请求吗?

It also maybe kaaiot, do they allow generic http request?

这篇关于PubNub 发布不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆