GithubHelp home page GithubHelp logo

Comments (6)

gguuss avatar gguuss commented on August 15, 2024

Thanks for the heads up, I took a look while adding exponential backoff, maybe you're passing the --deviceid as the first parameter?

from cpp-samples.

HMS-LIG avatar HMS-LIG commented on August 15, 2024

This is still broken as far as I can see. The example client now publishes to the hardcoded topic ""/devices/{your-device-id}/events"" as opts.topic is never changes from its initial string. Trying out the example results in an error notification on my registered device in the GCP stating:

mqtt: PUBLISH:Unauthorized MQTT publish topic: /devices/{your-device-id}/events, expects /devices/{device-id}/events

Looks like the only way to get it to publish to the correct topic is to manually modify the .topic = "/devices/{your-device-id}/events" string in the example code and rebuild.

The example code is referenced from documentation on page https://cloud.google.com/iot/docs/samples/mqtt-samples as the C example.

from cpp-samples.

SurferJeffAtGoogle avatar SurferJeffAtGoogle commented on August 15, 2024

Thank your the update. It looks like you did the right thing.

I did not write the sample, but I think the author actually intended for readers to modify the source code like you did. Do you see a way to better communicate that to the reader? Or perhaps, to not require the reader to modify the source code?

from cpp-samples.

HMS-LIG avatar HMS-LIG commented on August 15, 2024

I looked at the instructions provided in https://github.com/GoogleCloudPlatform/cpp-docs-samples/blob/master/iot/mqtt-ciotc/README.md and from reading that I don't think the (current) intention is to modify the source code as you can/must provide the different options on the command line, --deviceid for example (bottom of README). The MQTT topic must be automatically assembled from the deviceid you supply as command option.

I made a fix in line with the existing code that could be used for inspiration (not sure if I can accept the corporate CLA without approvement, so cant create a pull request yet) here:
HMS-LIG@1eb86de

from cpp-samples.

gguuss avatar gguuss commented on August 15, 2024

It's been a while since I last looked at the code here but the intention originally had been to support command-line parameters for the sample once it had been built. I'm not sure I actually tested it very thoroughly and I recall fixing an off-by-one bug on the ordered parameters.

from cpp-samples.

gguuss avatar gguuss commented on August 15, 2024

This should be fixed in:

#46

from cpp-samples.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.