Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [mosquitto-dev] mosquitto-dev Digest, Vol 47, Issue 7

For the use cases I have had for which I needed the capability to see
the payloads as hex, the messages transferred between clients have
been binary to save on space, but I have needed a logger that would
log the messages (either on-screen or to a log file) in their hex
representation for later analysis.  I have written my own logger
client in the past to achieve this - but it would be a nice option for
mosquitto_sub - to output the payload as hex instead of ASCII, since
not all payloads are ASCII.

Regards,
Brandon

On Wed, Nov 22, 2017 at 12:39 PM, Jeff Albrecht <jeffa@xxxxxxxxx> wrote:
> Are you the publisher too? How about json encode it? most json encoders also
> support a pretty or human print option to format it for easier human
> consumption.
>
> See also jpmens / jo https://github.com/jpmens/jo
>
>
> On 11/22/2017 10:24 AM, Surendra Manikandan wrote:
>
> Thank you guys!!
>
> Brandon understood my requirement, it is My broker publishes messages in HEX
> format and when I subscribe to it using command "mosquitto_sub -h <host> -p
> <port> -t <topic> " , it prints the payload as invalid characters. Actually
> it is being published in HEX format so it should be read by sub in HEX. I
> like to know how to get this done? Or any existing solution available for
> this.
>
> On Nov 22, 2017 10:30 PM, <mosquitto-dev-request@xxxxxxxxxxx> wrote:
>>
>> Send mosquitto-dev mailing list submissions to
>>         mosquitto-dev@xxxxxxxxxxx
>>
>> To subscribe or unsubscribe via the World Wide Web, visit
>>         https://dev.eclipse.org/mailman/listinfo/mosquitto-dev
>> or, via email, send a message with subject or body 'help' to
>>         mosquitto-dev-request@xxxxxxxxxxx
>>
>> You can reach the person managing the list at
>>         mosquitto-dev-owner@xxxxxxxxxxx
>>
>> When replying, please edit your Subject line so it is more specific
>> than "Re: Contents of mosquitto-dev digest..."
>>
>>
>> Today's Topics:
>>
>>    1. Requesting for mosquitto version which supports   payload in
>>       HEX format (Surendra Manikandan)
>>    2. Re: Requesting for mosquitto version which supports payload
>>       in HEX format (Adrian Brown)
>>    3. Re: Requesting for mosquitto version which supports payload
>>       in HEX format (Nicholas Humfrey)
>>    4. Re: Requesting for mosquitto version which supports payload
>>       in HEX format (Brandon Arrendondo)
>>
>>
>> ----------------------------------------------------------------------
>>
>> Message: 1
>> Date: Wed, 22 Nov 2017 10:26:37 +0530
>> From: Surendra Manikandan <surendra.manikandan@xxxxxxxxx>
>> To: mosquitto-dev@xxxxxxxxxxx
>> Subject: [mosquitto-dev] Requesting for mosquitto version which
>>         supports        payload in HEX format
>> Message-ID:
>>
>> <CA+O1z9ALNZP_K82yorRpn_pwrzvgwCKG-Jrxurvf58W=pE_fbw@xxxxxxxxxxxxxx>
>> Content-Type: text/plain; charset="utf-8"
>>
>> 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
>> -------------- next part --------------
>> An HTML attachment was scrubbed...
>> URL:
>> <https://dev.eclipse.org/mailman/private/mosquitto-dev/attachments/20171122/6c47354b/attachment.html>
>>
>> ------------------------------
>>
>> Message: 2
>> Date: Wed, 22 Nov 2017 05:06:30 +0000
>> From: Adrian Brown <adrianbro@xxxxxxxxx>
>> To: General development discussions for the mosquitto project
>>         <mosquitto-dev@xxxxxxxxxxx>
>> Subject: Re: [mosquitto-dev] Requesting for mosquitto version which
>>         supports payload in HEX format
>> Message-ID:
>>
>> <CAPzWwYommEnXvDhs24xBu-WP=4cJmOEtSYXrgVcnzL_CNXe_Fg@xxxxxxxxxxxxxx>
>> Content-Type: text/plain; charset="utf-8"
>>
>> 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
>>
>> --
>> Regards
>> Adrian Brown
>> -------------- next part --------------
>> An HTML attachment was scrubbed...
>> URL:
>> <https://dev.eclipse.org/mailman/private/mosquitto-dev/attachments/20171122/768530f2/attachment.html>
>>
>> ------------------------------
>>
>> Message: 3
>> Date: Wed, 22 Nov 2017 09:35:20 +0000
>> From: Nicholas Humfrey <njh@xxxxxxxxxx>
>> To: General development discussions for the mosquitto project
>>         <mosquitto-dev@xxxxxxxxxxx>
>> Subject: Re: [mosquitto-dev] Requesting for mosquitto version which
>>         supports payload in HEX format
>> Message-ID: <eb85582261a771f97d2f5a7e86ae3499@xxxxxxxxxx>
>> Content-Type: text/plain; charset=UTF-8; format=flowed
>>
>> 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
>> >
>> > --
>> >
>> > 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
>>
>>
>> ------------------------------
>>
>> Message: 4
>> Date: Wed, 22 Nov 2017 08:13:04 -0500
>> From: Brandon Arrendondo <barrendo@xxxxxxxxx>
>> To: General development discussions for the mosquitto project
>>         <mosquitto-dev@xxxxxxxxxxx>
>> Subject: Re: [mosquitto-dev] Requesting for mosquitto version which
>>         supports payload in HEX format
>> Message-ID:
>>
>> <CAMW8GMaDSznEzN_+86KNDfTe_j5uEJP0he4poT0XmpuOH-Kt4A@xxxxxxxxxxxxxx>
>> Content-Type: text/plain; charset="UTF-8"
>>
>> 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
>> >>
>> >>
>> >> --
>> >>
>> >> 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
>> >
>> > _______________________________________________
>> > 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
>>
>>
>> ------------------------------
>>
>> _______________________________________________
>> 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
>>
>> End of mosquitto-dev Digest, Vol 47, Issue 7
>> ********************************************
>
>
>
> _______________________________________________
> 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
>
>
>
> _______________________________________________
> 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