-
Notifications
You must be signed in to change notification settings - Fork 731
Description
Bug Description
I try to send big payload via websocket, but it doesn't work. Maximum sendable payload size depends on mqtt server, e.g. for test.mosquitto.org it's 129KB. Smaller payloads are sent correctly.
code for reproduce:
`import logging
import paho.mqtt.client as mqtt
logging.basicConfig(level=logging.DEBUG, format='%(asctime)s %(message)s', datefmt='%m/%d/%Y %I:%M:%S %p')
def on_publish(client, userdata, mid, rc, properties):
print("Published")
client.disconnect()
mqtt_client = mqtt.Client(mqtt.CallbackAPIVersion.VERSION2, protocol=mqtt.MQTTv5, transport="websockets")
mqtt_client.enable_logger()
mqtt_client.on_publish = on_publish
mqtt_client.connect("test.mosquitto.org", 8080, 60)
with open('upload_test', 'r', encoding="latin-1") as file:
msg = file.read()
result = mqtt_client.publish("upload_test", msg)
mqtt_client.loop_forever()`
Environment
python: 3.11
paho-mqtt: 2.1.0
MacOS: Version 15.3.2 (24D81)
Logs
logs for big payload:
`04/07/2025 01:25:31 PM Sending CONNECT (u0, p0, wr0, wq0, wf0, c1, k60) client_id=b'' properties=None
04/07/2025 01:25:31 PM sent 21
04/07/2025 01:25:31 PM Sending PUBLISH (d0, q0, r0, m1), 'b'upload_test'', properties=None, ... (132096 bytes)
04/07/2025 01:25:31 PM sent 131747
04/07/2025 01:25:31 PM Received CONNACK (0, Success) properties=[AssignedClientIdentifier : auto-
EBFC8081-C1D6-2593-D0BE-049A97D55F78, ReceiveMaximum : 10, TopicAliasMaximum : 10]
04/07/2025 01:26:32 PM Sending PINGREQ
04/07/2025 01:26:32 PM sent 381
04/07/2025 01:26:32 PM sent 6
04/07/2025 01:27:33 PM Sending CONNECT (u0, p0, wr0, wq0, wf0, c0, k60) client_id=b'' properties=None
04/07/2025 01:27:33 PM sent 21
04/07/2025 01:27:33 PM Received CONNACK (0, Success) properties=[AssignedClientIdentifier : auto-BB2AF71A-2AC4-8988-DB10-E00F7D62C895, ReceiveMaximum : 10, TopicAliasMaximum : 10]
04/07/2025 01:28:33 PM Sending PINGREQ
04/07/2025 01:28:33 PM sent 8
04/07/2025 01:28:33 PM Received PINGRESP
04/07/2025 01:29:34 PM Sending PINGREQ
04/07/2025 01:29:34 PM sent 8
04/07/2025 01:29:34 PM Received PINGRESP
04/07/2025 01:30:34 PM Sending PINGREQ
04/07/2025 01:30:34 PM sent 8
04/07/2025 01:30:34 PM Received PINGRESP
04/07/2025 01:31:34 PM Sending PINGREQ
04/07/2025 01:31:34 PM sent 8
04/07/2025 01:31:35 PM Received PINGRESP
04/07/2025 01:32:35 PM Sending PINGREQ
04/07/2025 01:32:35 PM sent 8
04/07/2025 01:32:35 PM Received PINGRESP
04/07/2025 01:33:36 PM Sending PINGREQ
04/07/2025 01:33:36 PM sent 8
04/07/2025 01:33:36 PM Received PINGRESP
04/07/2025 01:34:36 PM Sending PINGREQ
04/07/2025 01:34:36 PM sent 8
04/07/2025 01:34:36 PM Received PINGRESP
04/07/2025 01:35:36 PM Sending PINGREQ
04/07/2025 01:35:36 PM sent 8
04/07/2025 01:35:36 PM Received PINGRESP`
logs for smaller payload:
`04/07/2025 01:36:58 PM Sending CONNECT (u0, p0, wr0, wq0, wf0, c1, k60) client_id=b'' properties=None
04/07/2025 01:36:58 PM sent 21
04/07/2025 01:36:58 PM Sending PUBLISH (d0, q0, r0, m1), 'b'upload_test'', properties=None, ... (131072 bytes)
Published
04/07/2025 01:36:58 PM sent 131104
04/07/2025 01:36:58 PM Sending DISCONNECT reasonCode=None properties=None
04/07/2025 01:36:58 PM sent 8`