Freeboard的Orion数据源和Context Broker之间没有连接 [英] No connection between Freeboard's data source for Orion and Context Broker

查看:95
本文介绍了Freeboard的Orion数据源和Context Broker之间没有连接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在尝试连接Freeboard以可视化来自OCB的上下文信息,但是遇到了许多困难,使我无法从那里接收任何数据。我的想法是将Freeboard连接到OCB会出现问题,因为在OCB的订阅列表中没有任何新条目,并且Freeboard中的数据源表明它从未更新过。





OCB是作为docker容器打开。干舷在docker主机上运行。



我尝试通过以下方式将ip设置为从docker提取的ip:

  sudo docker inspect --format'{{.NetworkSettings.IPAddress}}'orion1 

它给了我172.17.0.3,但是在那上面也没有用。我想应该没有,因为只要我通过cUrl或Insomnia可以通过localhost:1026与OCB进行通信。我可以推送新实体,更新等等。





尚未运行的累积服务器(链接此处)现在可以。但问题是,我自己添加了订阅,并且无法在localhost(回送接口)上运行acc服务器,而无法在其他可用接口上运行acc服务器,然后将该接口的ip添加到我发送给OCB的订阅有效负载中。也许某处与Freeboard有冲突。

解决方案

此处的问题与缺少CORS支持有关。一个简单的解决方案就是在启动Orion Context Broker时启用CORS功能,如此处



我对此主题进行了相当(实际上是不必要的)研究,并提出了针对该问题的解决方案,此 github帖子。有一种代理服务器方法可以解决此问题。我想提出向Orion Context Broker添加CORS支持的建议,当发现它已经实施时,我感到非常惊讶。



有些帖子如 this ,对解决此案非常有帮助。 / p>

不过,我有两个要求。我想,关于OCB和外围软件的后端和文档,@ fgalan现在是一个不错的选择。


  1. 可以进一步强调CORS和ACCESS-CONTROL-ALLOW-ORIGIN解决方案吗?其背后的原因是,它提供了OCB与Internet浏览器中运行的任何前端应用程序或站点(即Freeboard)之间的无缝连接。它不应该如此隐藏,以至于我在寻找其他东西时偶然遇到了解决问题的方法。我猜想把它放在一些我不知道的其他地方的演练文档中。问题是我花了两个星期的时间来解决它,毕竟,简单易用的解决方案就在我的鼻子底下,寻求了不必要的解决方案。好消息是我在堆栈和git上都有良好的连接,因此已解决。滑倒Freeboard后,可能有人放弃了它。很遗憾,因为到目前为止,没有比Freeboard更好的可视化开源软件了。问题不仅限于Freeboard,正如我所说的,它涉及更多的前端应用程序和解决方案。当我们采用FIWARE的思维方式时,应该以不同的方式解决这些问题。


  2. 用于Freeboard的FIWARE数据源插件目前不值一毛钱。正如@fgalan在评论中指出的那样,它是为Orion Context Broker API的v1版本开发的,尚未更新。因此,它比想象的要复杂得多。正如OCB的文档所指出的那样,v1方法并不是真正的RESTfull。在对Freeboard的OCB插件进行了简短的代码审查之后,我可以说这不值得使用。据我了解,它应该仍然有效,因为OCB允许执行v1请求(但无论如何对我来说都行不通),所以这些请求已被弃用。我认为应该显示有关该主题的新帖子(不确定我应该与谁联系),因为有点误导。在我看来,使用不赞成使用的软件并散布与OCB互动的不良习惯的意义何在?



    在我看来,解决方案很简单。只需在Freeboard中使用JSON数据源。我了解在2015年没有RESTfull v2版本的OCB API的情况下为Freeboard创建单个数据源插件的动机,但是现在有了,所以为什么不使用它呢?从那时起,我就摆脱了CORS的麻烦,在我看来,它的效果很好。如前所述,干舷提供了巨大的机会,同时易于设置和维护。它不应该被轻易丢弃。



    通过在Freeboard中使用JSON有效负载的GET请求,现在我们可以完全访问OCB中的上下文查询了。只要我们使用Freeboard即可使用(通过查询要显示的数据)就不需要任何POST方法。投入

     ?options = keyValues 

    到请求的URL,我们已经获得了一种非常智能和紧凑的方式来可视化来自Broker的数据。



    这就是我认为应该解决的方法。在我看来,2015年有关此主题的最新更新还不够,尤其是在开发出更好的方法以从OCB访问上下文数据的情况下。



I've been trying to connect Freeboard to visualize context information from OCB, however came across difficulties that prevent me from receiving any data from there. My thinking is that there is a problem with connecting Freeboard to OCB, because in OCB's subscription list there are no any new entries, and datasource in Freeboard shows that it has never been updated.

OCB is turned on as a docker container. Freeboards run in docker host.

I tried setting the ip as ip that I extracted from docker by:

    sudo docker inspect --format '{{ .NetworkSettings.IPAddress }}' orion1

It gave me 172.17.0.3, but on that it didn't work either. I guess it shouldn't have anyways, because I can communicate with OCB by localhost:1026 as long as I do it via cUrl or Insomnia. I can push new entities, update and so on.

The accumulation server that has not been working (link here) is ok right now. But the thing is, I add subscription by myself and can't run the acc server on localhost (loopback interface), but rather on other avaliable interface, then add ip of that interface to subscription payload that i send to OCB. Maybe there is a conflict with Freeboard somewhere.

解决方案

The issue here was connected to lack of CORS support. The easy solution for this is just enabling CORS functionality while launching Orion Context Broker as described here.

I have conducted quite an (actually unnecessary) research on this topic and came up with over-the-top solution for the problem which is described in this github post. There is a proxy server approach for solving the issue. I wanted to propose adding CORS support to Orion Context Broker, and was kindly surprised when found out about it being already implemented.

There are posts like this, this and this which was very helpful in solving the case.

However, I have a two requests. I guess @fgalan is a go to person right now, regarding back-end and documentation of OCB and peripheral software.

  1. Can there be a stronger emphasis put on CORS and ACCESS-CONTROL-ALLOW-ORIGIN soulution? The reasoning behind it is that it gives a seamless connection between OCB and any front-endy application or site (i.e. Freeboard) running in internet Browser. It shouldn't be so hidden that I came across the solution for my problems just by accident while looking for something else. I guess putting it in some walkthrough documentation on I don't know some other visible place. The problem is that I spent two weeks trying to solve it and after all went for the over-the-top and unnecessary solution while the easy and accessible was just under my nose. Good thing is that I have a good connection on stack and git so it was resolved. There are probably people that gave up on Freeboard after any slip with it. And it's a shame, because for now there is no better opensource piece of software for visualization than Freeboard. And the problem is not only with Freeboard, as I said it concerns many more front-end applications and solutions. As we go with FIWARE's way of thinking, those things should be resolved differently.

  2. The FIWARE datasource plugin for Freeboard is not worth a dime at the moment. As @fgalan pointed out in comment it was developed for v1 version of Orion Context Broker API and has not been updated. Therefore it's way more complicated than it's suppose to be. As documentation of OCB fairly point out, v1 approach is not really RESTfull like. After conducting a short code review of OCB plugin for Freeboard I can say that's not worth using. As far as I understand it should still be working, because OCB allows for v1 request to be conducted (but it doesn't work for me anyway), those request are deprecated. In my opinion new post regarding topic should appear (not sure who should I contact about it), because this is a bit misleading. What's the point of using piece of software that's deprecated and spreading bad habits regarding interacting with OCB?

    Solution for this is in my opinion simple. Just use JSON datasource in Freeboard. I understand motivation behind creating individual datasource plugin for Freeboard in 2015, when there was not RESTfull v2 version of OCB API, but there is one now, so why not use it? I used ever since got rid of difficulties with CORS and it works pretty well in my opinion. Freeboard as I said earlier provides great opportunities while being easy in setup and maintenance. It should not be abandoned so easily.

    By using GET request for JSON payload in Freeboard, now we have whole access to query for context from OCB. It doesn't need any POST methods as long as we use Freeboard as it supposed to be used (by querying for data to visualize). Throw in

              ?options=keyValues
    

    to the request's URL and we've gotten ourselves a really smart and compact way of visualizing data coming from the Broker.

    That's just the way I thing it should be resolved. Last update on this topic coming in 2015 is just not enough in my opinion, especially if there were better methods developed on accessing context data from OCB.

这篇关于Freeboard的Orion数据源和Context Broker之间没有连接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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