Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Paho » Data structure of the messages in MQTT javascript Client PAHO
Data structure of the messages in MQTT javascript Client PAHO [message #1695770] Tue, 19 May 2015 08:11 Go to next message
ankur bhatia is currently offline ankur bhatiaFriend
Messages: 4
Registered: May 2015
Junior Member
Hello All,

I am using the Eclipse Paho javascript client to communicate between my device and the broker.
So currently I am sending a string in the message.

message1 = new Paho.MQTT.Message("Hello");

Is there a way I can send the message in any other format like a json or Google protocol Buffer instead of string?

Thankyou

Re: Data structure of the messages in MQTT javascript Client PAHO [message #1695782 is a reply to message #1695770] Tue, 19 May 2015 09:08 Go to previous messageGo to next message
Benjamin Cabé is currently offline Benjamin CabéFriend
Messages: 201
Registered: July 2009
Location: Toulouse, France
Senior Member

As long as you can provide a String or ArrayBuffer to the Message constructor, you will be fine.
In order to post a JSON document, that would e.g. be:

message1 = new Paho.MQTT.Message(JSON.stringify( { "first_name": "ankur", "last_name": "bhatia" } ));


Re: Data structure of the messages in MQTT javascript Client PAHO [message #1696142 is a reply to message #1695782] Fri, 22 May 2015 11:02 Go to previous message
ankur bhatia is currently offline ankur bhatiaFriend
Messages: 4
Registered: May 2015
Junior Member
Thanks a lot Benjamin.
Previous Topic:Not getting Published message from Mqtt Broker in Paho Client
Next Topic:Paho c++ build problem
Goto Forum:
  


Current Time: Fri Apr 19 15:43:15 GMT 2024

Powered by FUDForum. Page generated in 0.03056 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top