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

Subscribe dont work #565

Open
BeesUser opened this issue Sep 25, 2024 · 1 comment
Open

Subscribe dont work #565

BeesUser opened this issue Sep 25, 2024 · 1 comment

Comments

@BeesUser
Copy link

Hello mqtt 3 dosnt work this method, no changes, what i did wrong?
final s =
client.subscribe(topicOut, MqttQos.atLeastOnce)?.changes.listen((data) {
logger.e('change logs');
});

@shamblett
Copy link
Owner

This will only give you changes to the Subscription you have generated, if you want to receive publish messages on this subscription use the updates stream -

client.updates!.listen((List<MqttReceivedMessage<MqttMessage?>>? c) {
    final recMess = c![0].payload as MqttPublishMessage;
    final pt =
        MqttPublishPayload.bytesToStringAsString(recMess.payload.message);
...

See the examples in the examples directory.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants