Skip to content

umqtt subscribe to topic with 23 bytes fails #284

Description

@DDDanny

Hi,
I can't subscribe to topic longer than 122 bytes. Publishing works fine!
I kindly ask you to verify and hopefully fix it
Thanks a lot
Danny

OK - working:

#122 bytes
mqtt.subscribe(b"/234567890/234567890/234567890/234567890/234567890/234567890/234567890/234567890/234567890/234567890/234567890/234567890/2") 

but one more character:

#123 bytes
mqtt.subscribe(b"/234567890/234567890/234567890/234567890/234567890/234567890/234567890/234567890/234567890/234567890/234567890/234567890/23") 

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "test.py", line 169, in <module>
  File "umqtt_simple.py", line 154, in subscribe
  File "umqtt_simple.py", line 173, in wait_msg
OSError: -1

this might be related to #163 which also deals with 127 bytes

it might be related to

struct.pack_into("!BH", pkt, 1, 2 + 2 + len(topic) + 1, self.pid)
as this is hitting the 128...

Activity

  1. dpgeorge commented on Jun 1, 2018

    @dpgeorge
    Member

    It looks like the subscribe method needs to handle variable length encoding of the payload size, in the same way that connect and publish do.

  2. added 3 commits that reference this issue on Aug 27, 2018
    9b99c10
    4447e01
    d5a8533
  3. jonnor commented on Aug 25, 2024

    @jonnor

    This appears ot have been fixed in the linked MRs/commits. Proposing to close this issue.

  4. projectgus commented on Aug 27, 2024

    @projectgus
    Contributor

    Looks like the author's PR was closed last year without merging, so I think this may still be an issue.

  5. mbuehler1990 commented on Nov 19, 2024

    @mbuehler1990

    I had the same issue and @SpotlightKid fix worked for me. Sad that the PR is not merged

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions