kamilfb / mqtt-spy

Please use the new Eclipse Paho GitHub repo instead.
https://github.com/eclipse/paho.mqtt-spy/wiki
345 stars 68 forks source link

GZIP Compressed Messages #89

Closed masudh closed 8 years ago

masudh commented 8 years ago

Hi Kamil: Thanks for providing this tool. It's been a great help for our project. I have a question regarding subscribing or publishing compressed messages. If our application publishes a GZIP compressed message and support team want to subscribe to this topic mostly for troubleshoot purposes. Is there are way to do this in current product? If not, can you recommend a way around that we can implement?

kamilfb commented 8 years ago

Hi. Yes, that should be possible with a custom formatter. Could you supply a sample with a compressed message and what you would like to see in the UI?

masudh commented 8 years ago

thank you. Below is a sample of compressed message and decompress version of it. We would like to copy plain text, SPY would compress (java.util.gzip) and publish to the topic. When we subscribe, SPY will decompress and shows us the plain text.

¬‹ uP=oà ý/7“ê b¶Êí )•¢ÊêRe @ZK.Ž0q Eþï Çê”nÜÝûâ]áÐÛ ¨+ØV?±¹œ (¨ ¸Ñù8€z¿B Ý×íuÐÁôÖ5?1Áv;¹–¢,¤ õcbX×½¤#(Fàã4dYÓ{ÿä¢n»4±Pò¨x© W•SÚ$RF,¶ ̼&{ C*V(V¬j(W”)äiTˆ7ЛîZ

'2§ÛØ;y £ý]1ªJ¹ˆMûiO ôç˜ lk H3UŸ^Í k^œ f ‰¼ä2¯¾M>²u!’ O§­ ó§»6U7£iÉ ^2Z`ŠP%Rp¦ö©<J í‡;¨ «(§ E ö¿bØ_11øÏµ ] ÚÞçZ¶ˆt5² Óô €¢½1ò

{"body":{"diaEvtType":"90","events":[{"items":[{"barcodeTxt":"PP787654776CA","delMode":2,"gps":{"connDetails":"f4:7f:35:e3:9e:ac","connType":"4","gpsTms":"2016-06-29T13:12:03-06:00","gpsValid":0},"itemId":"PP787654776CA","scanTms":"2016-06-29T13:11:57-06:00"}]}],"route":"LC0601","sapRcType":"01","userId":"7035371","wc":"028460"},"header":{"clientId":"15343521402019","recCnt":1,"transId":"1534352140201920160629131202106","transTms":"2016-06-29T13:12:02-06:00","trnInd":0,"version":"PL001-v2.3"}}

kamilfb commented 8 years ago

Hi @masudh! Take a look at the commit referenced above - two files there - one is a publication script to send messages, second is a custom formatter. To create one, to go the Formatters window (Menu -> Open view -> Formatters), create a new script-based formatter, paste in the javascript, then apply any changes. Once added, it should appear under Tools -> Formatting -> Custom. Let me know how to get on...

masudh commented 8 years ago

Thanks a lot. I will try and let you know.