njh / ruby-mqtt

Pure Ruby gem that implements the MQTT protocol, a lightweight protocol for publish/subscribe messaging.
http://www.rubydoc.info/gems/mqtt
MIT License
541 stars 135 forks source link

proxy doesn't support client_id #94

Closed amias-channer closed 7 years ago

amias-channer commented 7 years ago

Many MQTT brokers use a client_id parameter to differentiate users , the MQTT::Proxy class doesn't seem to allow this. The connection is made in quite a different way it seems but I was hoping that I could chuck in the same parameters as MQTT::Client which does allow me to add a :client_id .

Happy to help create the code and help test (I'm a professional software tester) , however I'm fairly new to ruby and mqtt so others may well be quicker and better at this.

Thanks for sharing your work.

njh commented 7 years ago

Hi,

What makes you think that the client_id is not passed through?

The Proxy does not alter the MQTT packets - it just passes them straight through, with the opportunity to inspect/mutate them if you want to.

I have not used the proxy code in quite a long time and there was a bug in the logging code that I have now fixed. However I was able to verify that the client ID is passed through unmodified.

nick.

amias-channer commented 7 years ago

ah you are right , it does work , it seems my problem was that there was an issue with a missing method called type in MQTT::Packet , I fixed it making type call type_id and I'm seeing packets go back and forth now . Just sent you a pull request with the fix .

njh commented 7 years ago

Ok, glad you got this working.

I fixed the MQTT::Packet#type problem in 85a802c4cb0e812de8fa86e0bbbd68948cd0dff7