Skip to content
This repository

server - get versionNum/username/password from client object #22

Closed
franklovecchio opened this Issue July 28, 2012 · 0 comments

1 participant

Frank LoVecchio
Frank LoVecchio

I see that client.id can be grabbed from a connection, but I can't seem to get the versionNum/username/password from the client object (so I can verify auth with a db). I know that the client works with mqtt.io broker using user/pass and versionNum: 3.1.

    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
        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
Frank LoVecchio franklovecchio closed this July 29, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.