Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [mosquitto-dev] Requesting for mosquitto version which supports payload in HEX format

Hello,

I agree that it would be difficult to agree on the 'one true hex output format'.

Unfortunately it not possible to just pipe the output of mosquitto_sub to other processes for binary data because there is no way of distinguishing between a linefeed \n (10 in decimal) character appearing in the payload and mosquitto_sub indicating that it is the end of the message.


That is why I suggested a couple of new options to mosquito:

-1: Just receive a single message, then exit - if you just want the last retained message, this is sometimes good enough.

--exec: specify a command to execute for each message received

This would allow you to run:

mosquitto_sub -h test.mosquitto.org -t "your-topic-with-binary-data" --exec xxd | more

Then 'xxd' (or any other command for processing the payload) would be called for each message received.

Perhaps not very performant, but then if you wanted performance then you would probably be writing something using libmosquitto, as others have suggested.


nick.



On 2017-11-23 17:19, Aaron Chappelle wrote:
Maybe I'm not understanding correctly, but it sounds like you want to
display the binary output of your mosquitto_sub in hex format.  If so
just pipe it to another tool that can do so.  For example...

mosquitto_sub -h test.mosquitto.org [2] -t
"your-topic-with-binary-data" | xxd

cheers!

On Wed, Nov 22, 2017 at 5:13 AM, Brandon Arrendondo
<barrendo@xxxxxxxxx> wrote:

I think you misunderstand Surendra's request.

The output of mosquitto_sub, when receiving a message, is what he
wants a flag to manipulate.  Instead of taking the binary payload
and
trying to output in ASCII (resulting in many bad characters dumped
to
the terminal), he wants a flag that will cause all payloads received
by mosquitto_sub to be printed in hex output.

It is not an unreasonable request - I have wanted this and have
written my own clients to do this same thing.

Regards,
Brandon

On Wed, Nov 22, 2017 at 4:35 AM, Nicholas Humfrey <njh@xxxxxxxxxx>
wrote:
Hello,

I agree with Adrian - it is not quite clear what you are trying to
achieve.
Do you mean a 'binary' (non-text) payload?
mosquitto_sub supports binary payloads, it is just that there is
no way of
knowing when one message payload ends and the next begins - unless
you can
be sure the messages don't contain newline characters.


Did I imagine that there was a version of mosquitto_sub that
supports a '-1'
option to receive a single message and then exit? That may help
with a
binary message payload.

I wonder if it would be useful to be able to pass an '--exec'
command line
argument to mosquito_sub - which runs the specified command for
each message
received - with the message written to STDIN.


nick.




On 2017-11-22 05:06, Adrian Brown wrote:

Hi not sure what your question really is but this might help MQTT
is a
binary it’s payload agnostic so if want to send a payload
contain
hexadecimal characters you can

This might help you if your asking how to take a revived payload
and
turn it into hex and you don’t have coding experience node red
might
be a good start

Cheers
Adrian

On Wed, 22 Nov 2017 at 3:57 pm, Surendra Manikandan
<surendra.manikandan@xxxxxxxxx> wrote:

Hi Team,
I'm in need of formatting the payload in HEX format in the
output of
'mosquitto_sub' command. Can I get the mosquitto version which
supports formatting payload message?

Thanks,
Surendra
_______________________________________________
mosquitto-dev mailing list
mosquitto-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or
unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/mosquitto-dev [1]


--

Regards
Adrian Brown
_______________________________________________
mosquitto-dev mailing list
mosquitto-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or
unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/mosquitto-dev [1]

_______________________________________________
mosquitto-dev mailing list
mosquitto-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or
unsubscribe from
this list, visit
https://dev.eclipse.org/mailman/listinfo/mosquitto-dev [1]
_______________________________________________
mosquitto-dev mailing list
mosquitto-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or
unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/mosquitto-dev [1]



Links:
------
[1] https://dev.eclipse.org/mailman/listinfo/mosquitto-dev
[2] http://test.mosquitto.org
_______________________________________________
mosquitto-dev mailing list
mosquitto-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or
unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/mosquitto-dev


Back to the top