You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a question regarding the proxy settings for the MQTT client in the MQTTNet library.
At work, we have been utilizing MQTTNet for some time to send data from our local internal servers to a server hosted in Azure. This has been working fine. But recently IT has implemented a new internal VPN using IBoss that we are supposed to use as a proxy. This means that the firewall we used to pass through on port 1883 has now been closed since we are supposed to go through the proxy instead.
This has resulted in our client application using MQTTNet no longer being able to connect to the Azure-hosted server. But if I download another MQTT client it works just fine, for example, I have downloaded the MQTTX client and it is able to connect from our internal servers to the cloud server, even though our own client application can't.
I am suspecting that there are some proxy settings that need to be set within my client in MQTTNet. I have noticed on the MqttClientOptionsBuilder class that there is a WithProxy() method. But it seems this requires me to use WithWebSocketServer() instead of WithTcpServer(). But when I look at the log for the MQTTX client it looks like it is using a normal TCP connection. Not sure what the MQTTX client is doing differently.
Does anyone know how to configure a proxy for the MQTTNet client without using a web socket connection? Or is there maybe something else I can try?
from paho.mqtt import client as mqtt_client
broker = 'x.x.x.x'
port = 1883
topic = "VOS/#"
client_id = f'python-mqtt-{random.randint(0, 1000)}'
username = 'Username'
password = 'Password'
def on_connect(client, userdata, flags, rc):
if rc == 0:
print("Connected to MQTT Broker!")
else:
print("Failed to connect, return code %d\n", rc)
client = mqtt_client.Client(client_id)
client.username_pw_set(username, password)
client.on_connect = on_connect
client.connect(broker, port)
client.loop_start()
and it also works, just like the MQTTX client. There seems to be something different about the way the MQTTNet library establishes the connection that makes it not work. But I'm at a loss for what it might be.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hi all,
I have a question regarding the proxy settings for the MQTT client in the MQTTNet library.
At work, we have been utilizing MQTTNet for some time to send data from our local internal servers to a server hosted in Azure. This has been working fine. But recently IT has implemented a new internal VPN using IBoss that we are supposed to use as a proxy. This means that the firewall we used to pass through on port 1883 has now been closed since we are supposed to go through the proxy instead.
This has resulted in our client application using MQTTNet no longer being able to connect to the Azure-hosted server. But if I download another MQTT client it works just fine, for example, I have downloaded the MQTTX client and it is able to connect from our internal servers to the cloud server, even though our own client application can't.
I am suspecting that there are some proxy settings that need to be set within my client in MQTTNet. I have noticed on the MqttClientOptionsBuilder class that there is a WithProxy() method. But it seems this requires me to use WithWebSocketServer() instead of WithTcpServer(). But when I look at the log for the MQTTX client it looks like it is using a normal TCP connection. Not sure what the MQTTX client is doing differently.
Does anyone know how to configure a proxy for the MQTTNet client without using a web socket connection? Or is there maybe something else I can try?
My client options (removed sensitive info):
Thank you in advance for any help
Edit:
I just tried the following code in python
and it also works, just like the MQTTX client. There seems to be something different about the way the MQTTNet library establishes the connection that makes it not work. But I'm at a loss for what it might be.
Beta Was this translation helpful? Give feedback.
All reactions