emqtt icon indicating copy to clipboard operation
emqtt copied to clipboard

Update emqtt_frame.erl

Open gabrielmancini opened this issue 1 year ago • 2 comments

fix the packet parser to retrive the topic name

gabrielmancini avatar Mar 27 '25 15:03 gabrielmancini

hello @zmstone, sorry about the lac of the context,

i have try to create an tcp elixir "mqtt proxy" to a broker, and i have using this lib to parse mqtt packets, and i have tested using the MQTTX, and i really dont know why this is happend, i just find this aditional byte in topics, and when i ignore, my code works.

gabrielmancini avatar Apr 14 '25 20:04 gabrielmancini

Hi @gabrielmancini

SUBSCRIBE packet is for server to parse, I have to admit that it's possible that there is a lack of test coverage here in emqtt since it's a client library.

Had a quick look into the server side code (which is extensively tested) here: https://github.com/emqx/emqx/blob/bc7668078c80bf51ad996342e8ee6681adce41a4/apps/emqx/src/emqx_frame.erl#L659-L665

They seem to be the same, and I cannot seem to spot where the leading byte might have leaked from. It would be great if you can:

  1. Find the root cause (the byte must belong to the leading part of the SUBSCRIBE packet, before topics list)
  2. Add a test case

zmstone avatar Apr 14 '25 21:04 zmstone