ConnectingEurope / Context-Broker-Data-Visualisation

European Union Public License 1.2
8 stars 4 forks source link

subscriptions or socketio problem #23

Closed dnlwgnd closed 2 years ago

dnlwgnd commented 2 years ago

Hi there,

I am new to fiware and came across this tool that would address a core usecase. I did follow the instructions in the tutorial section and got the containers running (linux machine). I can access the webapp. Also I did the configuration accordingly and connected the webapp to the orion instance, setup a service, selected my entities. This all worked well and I immediately got my entities displayed on a map. Now my usecase involes entities that change their location frequently (my demodata updates the location ever second, but it needs to be more frequently ultimately) Unfortunately the webapp does not update the entities in realtime. Only every minute or so I observe an update on entity positions. I did expect this would update the entities in realtime (i.e. in milliseconds). Also the configuration page shows no subscriptions, which is probably the root cause. Also when I query orion on the subscriptions endpoint I do not find anything.

curl -X GET \
  'localhost:1026/v2/subscriptions' \
  -H 'Accept: application/json' \
  -H 'fiware-servicepath: /#' \
  -H 'fiware-service: ldm'

gives []

image image

In the server logs I found this (docker logs cbenabler-server -f)

GET /socket.io/?EIO=3&transport=polling&t=NlATzkS 404 0.424 ms - -
API not found
GET /socket.io/?EIO=3&transport=polling&t=NlAT-Do 404 0.498 ms - -
API not found
GET /socket.io/?EIO=3&transport=polling&t=NlAT_hb 404 0.457 ms - -
API not found
GET /socket.io/?EIO=3&transport=polling&t=NlAU0Ax 404 0.493 ms - -
API not found
GET /socket.io/?EIO=3&transport=polling&t=NlAU0gF 404 0.436 ms - -
API not found
GET /socket.io/?EIO=3&transport=polling&t=NlAU19Z 404 0.465 ms - -
API not found
GET /socket.io/?EIO=3&transport=polling&t=NlAU2dP 404 0.458 ms - -

Maybe the issue is around the service path? I have the following headers used

"fiware-service": "ldm",
"fiware-servicepath": "/ldm/daning_trees",

The entities look like this:

{
  "id": "trees-bs.50",
  "type": "tree",
  "ART_BOTAN": {
    "type": "Text",
    "value": "Quercus robur",
    "metadata": {}
  },
  "ART_DEUT": {
    "type": "Text",
    "value": "Stiel-Eiche",
    "metadata": {}
  },
  "BAUMHOEHE": {
    "type": "Number",
    "value": 19,
    "metadata": {}
  },
  "KRONNE": {
    "type": "Number",
    "value": 12,
    "metadata": {}
  },
  "STAMM": {
    "type": "Number",
    "value": 103,
    "metadata": {}
  },
  "location": {
    "type": "geo:json",
    "value": {
      "type": "Point",
      "coordinates": [
        10.508059204,
        52.265690035
      ]
    },
    "metadata": {}
  }
}

Any hints appreciated. Kind Regards.

afmartin3z commented 2 years ago

Hi @dnlwgnd,

Within the Context-Broker-DataVisualisation project, you can change the refresh interval in the client/src/app/features/map-dashboard/components/map-dashboard.component.ts class, but it won't help if your data is not updated every few seconds. this.interval = setInterval(() => { this.loadedIdsCopy = JSON.parse(JSON.stringify(this.loadedIds)); this.loadEntities(); }, 60000); I will open a task to extract the parameter as an environment variable.

dnlwgnd commented 2 years ago

Hi, thanks for the quick reply. I will try that. Wouldn't it be better to update the map immediately every time a notification from orion is received (and setup appropriate subscriptions)?

dnlwgnd commented 2 years ago

Hi @afmartin3z i tried your suggestions and it works. Thank you! (also sry that I missed it in the docs) I put it on 100ms and it seems to work well with a few entities. However, when I put like 1000 entities it becomes quite unresponsive. But this seems to be the limitations with this kind of application.