Skip to content

Amplify PubSub library Qos setting feature. #9527

@subhayum-amplify

Description

@subhayum-amplify

Is this related to a new or existing framework?

No response

Is this related to a new or existing API?

PubSub

Is this related to another service?

No response

Describe the feature you'd like to request

While using Amplify's PubSub library to subscribe to IoT Core topics, there is no way to configure the subscription's QoS level either to 0 or 1. Please provide a way to configure the same.

Describe the solution you'd like

The Solution could be something like setting a Qos flag value in the subscribe function as :

PubSub.subscribe('myTopic').subscribe({
qos:1,
next: data => console.log('Message received', data),
error: error => console.error(error),
complete: () => console.log('Done'),
});

Describe alternatives you've considered

Using the [+] https://github.com/aws/aws-iot-device-sdk-js#device-class to set the Qos value as of now works upon testing.
Sample code :

 var device = awsIot.device({
   keyPath: "<XXXX>-private.pem.key",
  certPath: "<XXXX>-certificate.pem.crt",
    caPath: "AmazonRootCA1.pem",
  clientId: "client1",
      host: "<XXX>-ats.iot.<region>.amazonaws.com",
      cleanSession: "False",
      keepalive: 30,
      options: {
        will: {
          topic: "abcd",
          payload: "My last will message"
        }
      }
});
//
// Device is an instance returned by mqtt.Client(), see mqtt.js for full
// documentation.
//
device
  .on('connect', function() {
    console.log('connect');
   // device.subscribe('mytopic');
    device.publish('mytopic', JSON.stringify({ test_data: 1}), {qos:1} );
  });
device
  .on('message', function(topic, payload) {
    console.log('message', topic, payload.toString());
  });

Additional context

No response

Is this something that you'd be interested in working on?

  • 👋 I may be able to implement this feature request
  • ⚠️ This feature might incur a breaking change

Metadata

Metadata

Assignees

No one assigned

    Labels

    PubSubRelated to PubSub categoryfeature-requestRequest a new feature

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions