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
543 stars 136 forks source link

Client#publish should reject blank topics with a sensible error message #47

Closed michaelklishin closed 10 years ago

michaelklishin commented 10 years ago

Right now publishing to an empty topic (by mistake) results in

mqtt/packet.rb:309:in `encode_body': Invalid topic name when serialising packet (RuntimeError)

It clearly should be an ArgumentError.

njh commented 10 years ago

Will look into this. Also just noticed that the payload parameter should be optional.