Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8302209
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T17:13:45+00:00 2026-06-08T17:13:45+00:00

Am I doing something wrong with the server for https://github.com/adamvr/MQTT.js ? I see client.id

  • 0

Am I doing something wrong with the server for https://github.com/adamvr/MQTT.js? I see client.id come in fine. Everything else comes in as undefined; I verified the MQTT client’s info with another broker using 3.1 user/pass, so I know the issue is not there.

    clients = { }

    server = mqtt.createServer (client) =>
      console.log 'Broker:mqtt:createServer'

      # Catch when client connects
      client.on 'connect', (packet) =>
        console.log 'Broker:connect'

        client.connack
          returnCode: 0

        client.id = packet.client

        console.log 'version: ' + client.versionNum # undefined
        console.log 'client: ' + client.id # COMES THROUGH FINE!
        console.log 'username: ' + client.username # undefined
        console.log 'password: ' + client.password # udefined

        clients[client.id] = client

        console.log 'clients: ' + JSON.stringify clients

   ...

    server.listen 1883

I also created an issue under the project: https://github.com/adamvr/MQTT.js/issues/22

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T17:13:47+00:00Added an answer on June 8, 2026 at 5:13 pm

    The client object you receive on the connect event doesn’t contain any of the parameters you’re seeking. The only reason client.id has the correct value is because you’re setting it in the line above. The packet passed with the event contains the properties.

    clients = { }
    
    server = mqtt.createServer (client) =>
      console.log 'Broker:mqtt:createServer'
    
      # Catch when client connects
      client.on 'connect', (packet) =>
        console.log 'Broker:connect'
    
        client.connack
          returnCode: 0
    
        client.id = packet.client
    
        console.log 'version: ' + packet.versionNum
        console.log 'client: ' + packet.client
        console.log 'username: ' + packet.username
        console.log 'password: ' + packet.password
    
        clients[client.id] = client
    
        console.log 'clients: ' + JSON.stringify clients
    
     ...
    
    server.listen 1883
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

maybe im doing something wrong but try this sample on your server/local if i
I'm probably doing something wrong. Scenario: 3 computers: server, laptop and firewalled machine, no
I must be doing something wrong here. I'm trying to use Google Analytics to
(Maybe I am doing something wrong but) I am getting awful read performance from
Perhaps I am doing something wrong while z-normalizing my array. Can someone take a
I may be doing something wrong, but I haven't been able to find a
Unless I am doing something wrong, the way I am supposed to use ConfigurationSection,
I must be doing something wrong here (because really, what are the chances of
So obviously I am doing something wrong, but I just cannot seem to get
Maybe I'm doing something wrong but I have a textarea where I've specified textAlign

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.