Nolv
Nolv

Reputation: 63

Error 128 (0x80) while trying to subscribe to topic with paho-mqtt

I'm using hbmqtt 0.9.6 as a broker and paho-mqtt 1.5.1 as a client. Both of them support MQTT v3.1.1.

Broker configuration:

listeners:
    default:
        type: tcp
    halp:
        max-connections: 33
        bind: 127.0.0.3:1883
topic-check:
    enabled: false
auth:
    allow-anonymous: true

Client code:

import paho.mqtt.client as mqtt

def on_connect(client, userdata, flags, rc):
    print("Connected with result code " + str(rc))
    client.subscribe('abc')

def on_message(client, userdata, msg):
    print(msg.topic + " " + str(msg.payload))

def on_subscribe(mosq, obj, mid, qos):
    print("Subscribed: " + str(mid))
    print("Granted QoS: " + str(qos[0]))

client = mqtt.Client(client_id="subscriber", transport="tcp")

client.on_connect = on_connect
client.on_message = on_message
client.on_subscribe = on_subscribe

client.connect("127.0.0.3", 1883)

client.loop_forever()

The client establishes a connection to the broker correctly and can send messages to the broker without any problems. But when I try to subscribe to a topic, I receive Granted QoS: 128. What can cause that kind of problem?

What I've tried:

  1. Change topic name
  2. Change IP address and port
  3. Change transport from TCP to ws
  4. Change OS (tried on Armbian and Ubuntu)
  5. Use authentication with login:password

Upvotes: 2

Views: 2793

Answers (1)

Nolv
Nolv

Reputation: 63

Fraschbi was right. The problem was with the specified version of hbmqtt: it ignored permission configurations. A workaround is to specify what topics the client can subscribe to.

Upvotes: 1

Related Questions