unable to get pubsub messages, 'pubsub:event' is not fired using stanza.io

91 Views Asked by At

I am working with pubsub on ionic framework and i'm using stanza.io library, i'm able to publish message and call getItems from node. but 'pubsub:event' is not fired. i'm unable to get real-time message which is published on node by other users. my code is as below...

publish

this.client.publish("pubsub.dev1.internal", 'mynode', {
        json: {
          value: 'Any JSON content could go here'
        }
      }, (err, data) => {
        if (err) {
          console.log(err);
        } else {
          console.log(data)
        }
      });
  }

getItems

this.client.getItems("pubsub.dev1.internal", 'mynode', opts ,
      (err, data) => {
        if (err) {
          console.log(err);
        } else {
          console.log(data)
        }
      })

pubsub:event

this.client.on('pubsub:event', function (msg) {
      console.log("pubsub:event");
      console.log(msg);
    });

messages which are published are stored in server and when i call getItems i can fetch that messages, but the problem is messages are not received on real-time using 'pubsub:event'. can anyone help me to solve this?

0

There are 0 best solutions below