Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[paho-dev] Lua client: Changing connect method

Hi,

I think we should change connect method to stick better whith MQTT 3.1 [1].

As I am writing this method method looks like:

  function MQTT.client:connect(                                     -- Public API
    identifier,    -- string: MQTT client identifier (maximum 23 characters)
    will_topic,    -- string: Last will and testament topic
    will_qos,      -- byte:   Last will and testament Quality Of Service
    will_retain,   -- byte:   Last will and testament retention status
    will_message)  -- string: Last will and testament message

I think it should follow specs and include authentication parameters.
Result is:

  function MQTT.client:connect(                                     -- Public API
    identifier,    -- string: MQTT client identifier (maximum 23 characters)
    will_topic,    -- string: Last will and testament topic
    will_message,  -- string: Last will and testament message
    user_name,     -- string: User who is connecting
    password,      -- string: Password corresponding to the user who is connecting
    will_qos,      -- byte:   Last will and testament Quality Of Service
    will_retain)   -- byte:   Last will and testament retention status

Even better allowing to provide parameter within a table.
It avoid passing silly "nil" while connecting.
So users could type:

  client:connect({
    identifier = id,
    will_topic = will,
    will_retain = 'So long',
  })

Looking forward for comments.

Kevin

[1] http://public.dhe.ibm.com/software/dw/webservices/ws-mqtt/mqtt-v3r1.html#connect


Back to the top