We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I would like to be able to connect with a manually provided socket.
This would enable me to tunnel MQTT through an SSH connection with paramiko.
import paramiko # connect to SSH gateway sshclient = paramiko.SSHClient() sshclient.connect("sshgateway.example.org", "user", "password") def create_socket(): # open tunnel to the internal MQTT port return sshclient.get_transport().open_channel('direct-tcpip', ("127.0.0.1", 1883), ('', 0)) import paho.mqtt.client as mqtt mqttc = mqtt.Client(mqtt.CallbackAPIVersion.VERSION2) mqttc.connect("127.0.0.1", transport="callback", create_socket=create_socket)
import socket def create_socket(): sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) sock.connect(('mqtt.example.org', 1883)) return sock import paho.mqtt.client as mqtt mqttc = mqtt.Client(mqtt.CallbackAPIVersion.VERSION2) mqttc.connect("mqtt.example.org", transport="callback", create_socket=create_socket)
For now, I can use my own SocketedClient class, which inherits Client and uses a provided create_socket function on connect() and reconnect().
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Feature Description
I would like to be able to connect with a manually provided socket.
This would enable me to tunnel MQTT through an SSH connection with paramiko.
Requested Solution
Alternatives
For now, I can use my own SocketedClient class, which inherits Client and uses a provided create_socket function on connect() and reconnect().
The text was updated successfully, but these errors were encountered: