Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PubSub subscription callback #6064

Closed
UnderSampled opened this issue Jun 11, 2020 · 6 comments
Closed

PubSub subscription callback #6064

UnderSampled opened this issue Jun 11, 2020 · 6 comments
Assignees
Labels
feature-request Request a new feature PubSub Related to PubSub category

Comments

@UnderSampled
Copy link

Is your feature request related to a problem? Please describe.
I need to send a message to an MQTT topic after subscribing to it, so I can hear the response. Currently, I'd have to set a dumb timeout to give the broker just a little time to process the subscription request

Describe the solution you'd like
A callback/promise/connection event for PubSub.subscribe

Describe alternatives you've considered
I currently use a different MQTT library (the aws-iot-device-sdk), since it supports this sort of callback.

@UnderSampled UnderSampled added the feature-request Request a new feature label Jun 11, 2020
@UnderSampled
Copy link
Author

UnderSampled commented Jul 23, 2020

It seems that Paho supports a success callback on the call to subscribe. It should be possible to await that in the call in Mqtt over WS.

@nzjoel1234
Copy link

Is there any possibility of this being done? The subscribe is not very useful without it.

@amhinson amhinson added the PubSub Related to PubSub category label Oct 19, 2020
@MikeSussman
Copy link

Any updates please as I am experiencing a similar issue in that my first Pub after subscribing to get the shadow state is not receiving data. If I wait and then manually trigger a pub I get the data.

@stocaaro
Copy link
Contributor

stocaaro commented Aug 22, 2022

Good news. We've added Hub events that you can now listen to to know when the IoT connection state changes, such as when it becomes Connected. Here are instructions on how to use this feature with a list of the different states you can watch for.

@leofolive
Copy link

@stocaaro
How can I verify that my subscription has successfully connected? I have 70+ in-app subscriptions on my mqtt client, but Hub.listen doesn't tell me specifically about each subscription.

I need to do this because I can only publish to a topic after being 100% connected with some subscriptions.

@stocaaro
Copy link
Contributor

Hello @LFMAKER,

I added a reply to this question over on #2692.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-request Request a new feature PubSub Related to PubSub category
Projects
None yet
Development

No branches or pull requests

6 participants