Using Data Events

Hi there,

today I developed a prototype to test the DataEvents on calponia-latest. The application connects with the message broker (I see this in the logs) but I do not get any subscription ( Task created, updated, deleted ). What do I miss? I followed your example in the documentation.

Thx, Gregor

hi @gregor.schaefer

hard to say. I just run our internal sample app on latest, which is subscribes all events:

You can try to wildcard all events *.*.* and check if you get any events.
Also double check, you are in the correct the project, when starting the instance & doing the changes.

If it’s still not working, provide some more information like:

  • from where do you connect
  • app-name
  • instance id

Best regards
Thomas

Hi @thomas.schuerle,
I tried to wildcard all events and I didn’t get a response. The reconnectDelay is set to default (5sek).
My token was created via post to data-event-tokens.

Some more information:

  • I connect via wss because the test-application runs on my local machine outside of calponia.
  • I also use a httpAgent (tunnel npm-package) to get through our proxy (also tried without - not working).
WEBSOCKET_ENPOINT="wss://data-events.calponia-latest.de"

Here is my code example. The options (ClientOptions) for the WS are undefined or a proxy agent.

      const client = new Client({
        webSocketFactory: () => {
          return new WebSocket(process.env.WEBSOCKET_ENPOINT, options);
        },
        connectHeaders: {
          login: process.env.LOGIN_TOKEN,
          host: '/protected/'
        },
        // reconnectDelay: 1000,
        onConnect: (message) => {
          console.log("onConnect", message, message.body.toString());

          client.subscribe(`/exchange/project.${process.env.CALPONIA_PROJECT_ID}/*.*.*`, async (message) => {
            const event = JSON.parse(message.body.toString());
            console.log(`Any change was done for project ${process.env.CALPONIA_PROJECT_ID} at: ${new Date().toLocaleTimeString()}`, event);
          });
        },
        onStompError: (err) => {
          console.log("onStompError", err);
        },
        onWebSocketError: (err) => {
          console.log("onWebSocketError", err);
        }
      });
      client.activate();

This is the response of my onConnect-Log

onConnect

FrameImpl {
  command: 'CONNECTED',
  headers: {
    version: '1.2',
    'heart-beat': '10000,10000',
    session: 'session-WjMaDp7Antji8ZQdO16crw',
    server: 'RabbitMQ/3.10.2'
  },
  _binaryBody: Uint8Array(0) [],
  isBinaryBody: true,
  escapeHeaderValues: false,
  skipContentLengthHeader: false,
  _body: ''
} ```


Best regards,
Gregor

ah, you running it locally.

Seems there was a minor issue. Please re-try now

Thanks
Thomas

Thx you very much, now it works fine!