Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for Kura's payload format #56

Closed
darugnaa opened this issue Jan 7, 2016 · 12 comments
Closed

Add support for Kura's payload format #56

darugnaa opened this issue Jan 7, 2016 · 12 comments
Assignees
Milestone

Comments

@darugnaa
Copy link
Contributor

darugnaa commented Jan 7, 2016

Hi Kamil,
I was thinking about implementing a custom payload decoder/encoder to support Kura's payload format.
However I can't fully understand where and how the incoming messages processing happens.
Could you share some hints to point me in the right direction? I saw a "Custom" menù item that is actually disabled, so I think there's a way to "plug" new decoders.
Thanks.

@kamilfb
Copy link
Owner

kamilfb commented Jan 8, 2016

Hi,

One way to do that is to define a custom formatter. Go to Menu -> Window -> Open View -> Formatters and add a new script-based formatter. Then you can edit the sample javascript to do what you need.

Once you've got your formatter defined, you can then select it for a connection.

Let me know how you get on with that...

@kartben
Copy link

kartben commented Jan 22, 2016

That would be a great addition, yes!
@kamilfb , since the Kura payload is actually encoded using Protocol Buffers, will that be possible for the provided script to import an external protobuf JS library from, say, a CDN?

@kamilfb
Copy link
Owner

kamilfb commented Jan 27, 2016

All sounds possible I think! I haven't used Kura before though, but I'm very happy to help on that. What would help:

  • have public Kura running somewhere and publishing over MQTT
  • get a sample Java app receiving those updates and formatting it right
  • then we can easily add it to mqtt-spy

@darugnaa, @kartben, is it something you could assist with?

@darugnaa
Copy link
Contributor Author

I was thinking about a Java solution (some sort of plugin maybe?).
I'll dig a bit into javascript formatters and see what I can get.

@kamilfb
Copy link
Owner

kamilfb commented Jan 30, 2016

To help me better understand what we are trying to achieve, could you post a sample of how you would use the custom payload encoder/decoder? Could you attach an example of how the message looks like when it is encoded, and how it could look like when decoded?

@kartben
Copy link

kartben commented Jan 30, 2016

I shall do that!

Le sam. 30 janv. 2016 01:18, Kamil Baczkowicz notifications@github.com a
écrit :

To help me better understand what we are trying to achieve, could you post
a sample of how you would use the custom payload encoder/decoder? Could you
attach an example of how the message looks like when it is encoded, and how
it could look like when decoded?


Reply to this email directly or view it on GitHub
#56 (comment).

@kartben
Copy link

kartben commented Feb 4, 2016

Hi @kamilfb – is that helpful? https://gist.github.com/kartben/a07c6f5cb1aa3ad6473d

@kamilfb
Copy link
Owner

kamilfb commented Feb 4, 2016

Yes - thank you @kartben! Have you also got a live feed of Kura's MQTT messages that I could test with? E.g. iot.eclipse.org?

@kartben
Copy link

kartben commented Feb 4, 2016

It's not "live", but there's a few Kura gateways that do post messages on "$EDC/#" root topic once in a while. Now that I think about it, I realize that the payload can also be gzipped, if that's what's configured in the Kura settings.

So I guess you have now two ways for testing:

  • either listen to iot.eclipse.org, and once in a while it's likely you may see messages with a gzipped payload (with protobuf in it)
  • test with my non-gzipped dump, which you can easily re-publish on a topic of your choice

@kamilfb
Copy link
Owner

kamilfb commented Feb 4, 2016

@darugnaa @kartben I believe I made some progress :)

Before formatting:
before

After formatting:
after

Is that the sort of thing you are after?

@kamilfb
Copy link
Owner

kamilfb commented Feb 4, 2016

You can try it now with mqtt-spy 0.5.0 beta build 4. Just follow the example in the Formatting wiki page to set up a new formatter and the use it.

@kamilfb kamilfb added this to the 0.5.0 milestone Feb 6, 2016
@kamilfb
Copy link
Owner

kamilfb commented Mar 6, 2016

@darugnaa @kartben mqtt-spy 0.5.0 beta build 7 has got a built-in Eclipse Kura formatter. Also, it converts the payload automatically to JSON and does pretty formatting on it. Could you confirm it is working as expected?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants