• United States
IBM?
  • Site map
IBM?
  • Marketplace

  • Close
    Search
  • Sign in
    • Sign in
    • Register
  • IBM Navigation
IBM Developer Answers
  • Spaces
    • Blockchain
    • IBM Cloud platform
    • Internet of Things
    • Predictive Analytics
    • Watson
    • See all spaces
  • Tags
  • Users
  • Badges
  • FAQ
  • Help
Close

Name

Community

  • Learn
  • Develop
  • Connect

Discover IBM

  • ConnectMarketplace
  • Products
  • Services
  • Industries
  • Careers
  • Partners
  • Support
10.190.13.206

Refine your search by using the following advanced search options.

Criteria Usage
Questions with keyword1 or keyword2 keyword1 keyword2
Questions with a mandatory word, e.g. keyword2 keyword1 +keyword2
Questions excluding a word, e.g. keyword2 keyword1 -keyword2
Questions with keyword(s) and a specific tag keyword1 [tag1]
Questions with keyword(s) and either of two or more specific tags keyword1 [tag1] [tag2]
To search for all posts by a user or all posts with a specific tag, start typing and choose from the suggestion list. Do not use a plus or minus sign with a tag, e.g., +[tag1].
  • Ask a question

How to set up mqtt in BlueMix NodeRed to subscribe to messages sent by my devices?

310002QX9T gravatar image
Question by Sideralis  (1) | Dec 28, 2016 at 02:53 AM iotnode-redmqttwatson-iotbrokeribmcloud

Hello,

I am new to Bluemix and may have not still understood all the logic.

I have registered a device and can send MQTT messages from it to Bluemix. On NodeRed running on https://myappname.eu-gb.mybluemix.net and configured with Input IBM IoT connected to output debug, I can see my messages. I was expecting to see the same with input mqtt configured with

 server = myorgid.messaging.internetofthings.ibmcloud.com
 port = 1883 or 8883
 topic = the topic I used to push
 client id = blank
 security username = blank or use-token-auth
 security password = blank or token

But unfortunately, I do see nothing in the output debug connected to this input mqtt.

I tried to subscribe to my messages with mosquitto_sub using the same config, but here also I do not receive anything.

Where am I wrong?

Thanks in advance for your support.

People who like this

  0   Show 1
Comment
10 |3000 characters needed characters left characters exceeded
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
27000182R2 gravatar image ValerieLampkin (2805) ♦   Jan 03, 2017 at 04:28 PM 0
Share

Are you supplying the user name and password or leaving it blank?

Per the MQTT connectivity for devices IoT platform documentation, the user name is the same value for all devices: use-token-auth

The device's authentication token is specified as the password. The password for each device is the unique authentication token that was generated when the device was registered with Watson IoT Platform

2 answers

  • Sort: 
270003TGA5 gravatar image

Answer by idani (624) | Jan 04, 2017 at 12:08 AM

Hi Sideralis, you cannot subscribe subscribe to a topic using (use-token-auth) authentication mechanism, you have to go into the IoT Platform dashboard, generate a API-key and API-token the use them to authenticate and subscribe to the events (topic) published by the device. You can find more details about this here:

https://console.ng.bluemix.net/docs/services/IoT/applications/mqtt.html

As a note, a device can only subscribe to a command topic.

Hope it helps!

Daniel

Comment

People who like this

  0   Share
10 |3000 characters needed characters left characters exceeded
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
310002QX9T gravatar image

Answer by Sideralis (1) | Jan 04, 2017 at 01:52 AM

Thanks for your answers.

Are you supplying the user name and password or leaving it blank?

With port 8883, I was supplying use-token-auth and my token as username and password.

Now, where I am not fully clear with all your explanations is:

As I want to subscribe to a topic from NodeRed running in my BlueMix application, should I follow:

  • MQTT connection for applications

or

  • MQTT connection for devices

And regarding this sentence:

As a note, a device can only subscribe to a command topic.

How is, the link between the event I sent and the command I want to subscribe, made?

Does it mean that I need to push a command?

Anyway, I will do some more tries with the help of the documentation provided. Thanks for that.

Comment

People who like this

  0   Show 1   Share
10 |3000 characters needed characters left characters exceeded
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
27000182R2 gravatar image ValerieLampkin (2805) ♦   Jan 04, 2017 at 07:10 AM 0
Share

Port 8883 is for SSL secure connections, even using port 1883 you would need to authenticate and not leave your auth info blank.

If you are using Node-RED you can connect as an application or as a device, but if you connect as a device you can only subscribe to commands and not events.

If your goal is to read events, then you should do as Daniel suggested and connect as an application with API key and token. Your application can then use logic to publish a command should you wish to have a device subscribe to commands based on the event information your application receives.

Follow this question

134 people are following this question.

Answers

Answers & comments

Related questions

How to communicate to beagle bone black using watson iot platform? 1 Answer

Can't connect Raspberry Pi using TLS with Client Certificate and Token to Watson IoT Platform? 1 Answer

IoT Authorization Error 7 Answers

How do you configure dynamic device ID and device type in Watson IoT Platform I/O node? 2 Answers

Connecting IoT App and Service to Raspberry Pi GPIO 1 Answer

  • Contact
  • Privacy
  • IBM Developer Terms of use
  • Accessibility
  • Report Abuse
  • Cookie Preferences

Powered by AnswerHub

Authentication check. Please ignore.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • API Connect
  • Analytic Hybrid Cloud Core
  • Application Performance Management
  • Appsecdev
  • BPM
  • Blockchain
  • Business Transaction Intelligence
  • CAPI
  • CAPI SNAP
  • CICS
  • Cloud Analytics
  • Cloud Automation
  • Cloud Object Storage
  • Cloud marketplace
  • Collaboration
  • Content Services (ECM)
  • Continuous Testing
  • Courses
  • Customer Experience Analytics
  • DB2 LUW
  • DataPower
  • Decision Optimization
  • DevOps Services
  • Developers IBM MX
  • Digital Commerce
  • Digital Experience
  • Finance
  • Global Entrepreneur Program
  • Hadoop
  • Hybrid Cloud Core
  • IBM Cloud platform
  • IBM Design
  • IBM Forms Experience Builder
  • IBM Maximo Developer
  • IBM StoredIQ
  • IBM StoredIQ-Cartridges
  • IIDR
  • ITOA
  • InformationServer
  • Integration Bus
  • Internet of Things
  • Kenexa
  • Linux on Power
  • LinuxONE
  • MDM
  • Mainframe
  • Messaging
  • Node.js
  • ODM
  • Open
  • PowerAI
  • PowerVC
  • Predictive Analytics
  • Product Insights
  • PureData for Analytics
  • Push
  • QRadar App Development
  • Run Book Automation
  • Search Insights
  • Security Core
  • Storage
  • Storage Core
  • Streamsdev
  • Supply Chain Business Network
  • Supply Chain Insights
  • Swift
  • UBX Capture
  • Universal Behavior Exchange
  • UrbanCode
  • WASdev
  • WSRR
  • Watson
  • Watson Campaign Automation
  • Watson Content Hub
  • Watson Marketing Insights
  • dW Answers Help
  • dW Premium
  • developerWorks Sandbox
  • developerWorks Team
  • Watson Health
  • More
  • Tags
  • Questions
  • Users
  • Badges