Giter Club home page Giter Club logo

Comments (6)

cocoaway avatar cocoaway commented on August 27, 2024

Hello,
I'm trying to make a request/response publish but is not clear how set Response topic and Correlation data in
:emqtt.publish(Client, Topic, Properties, Payload, PubOpts)

Can you provide how set Properties ?

Thx.

Luca

from emqtt.

emiltin avatar emiltin commented on August 27, 2024

Did you find an answer to this? I'm also wondering how to set the response topic.

from emqtt.

qzhuyan avatar qzhuyan commented on August 27, 2024

just set in Properties map, take a look in emqtt_props.erl.

from emqtt.

emiltin avatar emiltin commented on August 27, 2024

Thank you. Right, I can set 'Response-Topic' to a string, and I now see this logged when I publish:

[debug] [clientid: "emqtt-ab49cf24b912acf684db", msg: ~c"SEND_Data", packet: {:mqtt_packet, {:mqtt_packet_header, 3, false, 1, false}, {:mqtt_packet_publish, "command/tlc_582a/plan", 14, %{"Response-Topic": "response/tlc_582a"}}, "7"}, socket: #Port<0.30>]

But when another client receives this I don't see any properties:

%{
  client_pid: #PID<0.189.0>,
  dup: false,
  packet_id: 1,
  payload: "7",
  properties: %{},
  qos: 1,
  retain: false,
  topic: "command/tlc_582a/plan",
  via: #Port<0.12>
}

Shouldn't I see the Response-Topic as a property when I receive the message? Or is there another way to get it?

Note: I'm using Elixir.

from emqtt.

thalesmg avatar thalesmg commented on August 27, 2024

Did you connect using MQTT protocol version 5?

{:ok, c} = :emqtt.start_link(proto_ver: :v5, ...)

from emqtt.

emiltin avatar emiltin commented on August 27, 2024

Great tip! I thought I did, but realized I only did so in one of the clients, not the other. Now it works 👍

from emqtt.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.