wanghaEMQ / pynng-mqtt

MIT License
9 stars 3 forks source link

MQTT over QUIC #1

Closed sohanpatil1 closed 1 year ago

sohanpatil1 commented 1 year ago

Hello,

I am trying to send payload from a publisher to a subscriber implemented in python. How do I set it up such that it works with MQTT over QUIC? The README says it is capable of running with EMQX v5.

I have access to macOS M1 and Ubuntu 22.04 and I am open to working on either depending on what you recommend for this package.

Anything helps, Thanks

wanghaEMQ commented 1 year ago

Yes! It works with EMQX v5.x! I will update the readme and provide a simple tutorial about installation and its requirement later.

wanghaEMQ commented 1 year ago

You may need to modify the MQTT server address in examples/mqttpub.py and examples/mqttsub.py. And the msgs sent or received are on QUIC protocol by default.

sohanpatil1 commented 1 year ago

Thanks for the quick response and offering the instructions for setting it up. I had two concerns,

How do I fix this? I searched online but couldn't figure it out. Thanks, Sohan

wanghaEMQ commented 1 year ago

mkdir -f build is one of the commands for installing msquic to the system. Is this correct? What should it be instead?

I am sorry for my mistake. The command should be mkdir -p build.

When I try pip3 install -e . in the pynng-mqqt directory, I see this error

Maybe a version mismatch happened on cffi. cffi-1.15.1 is requires. But only cffi-1.15.0 be found on your system.

When I tried sudo apt install libssl, Linux was unable to locate package libssl. I added libssl3 instead. Please let me know if this needs to be corrected

Is there are libssl-dev package found?

sohanpatil1 commented 1 year ago

I checked my cffi installation version, it is 1.15.1. I checked it with 'pip show cffi'. Yes there is a libssl-dev package and I have added it. However, still getting the same error. image

I am using python 3.10.6

wanghaEMQ commented 1 year ago

Try to downgrade cffi to 1.15.0

sudo pip3 install cffi==1.15.0

Better if you remove it first

sohanpatil1 commented 1 year ago

I downgraded cffi to 1.15.0. I am following this website for assistance. I ran these commands to make it work. I used sudo when I realized there were permission issues. However I am still stuck.

image

I have printed my console below:

image image

wanghaEMQ commented 1 year ago

Your local installation (/home/ubuntu/.local/lib/python3.10/...) failed. When you try to run the mqttsub.py. It finds the pynng in your local installation first. But not your global success one (/usr/local/lib/python3.10/...).

Perhaps you could run with sudo. Or remove the local failed one. :)

sohanpatil1 commented 1 year ago

I believe I have safely removed the local one. When I run the 2 python files (mqttsub.py and mqttpub.py), they both stop at async-await on line 22/24 and no connection message is sent. I have reviewed the files to see where the issue maybe, but no luck. Is it because of the mqtt server address? Any help would be greatly appreciated!

EDIT : I searched on EMQX's website and I noticed "mqtt-quic:127.0.0.1:14567" for QUIC and looks like it is correct. What's causing the issue?

wanghaEMQ commented 1 year ago

Did you forget to start your emqx broker? or the option in the configuration which enables QUIC? You could check if there are any processes listening 14567

sudo lsof -i:14567
sohanpatil1 commented 1 year ago

Yes you were right. I did not have EMQX installed on the Ubuntu22.04 instance. I am now working on Ubuntu 20.04. All my progress so far was for the 22.04 installation. My question now, is for the new installation on Ubuntu 20.04

On running 'pip install -e .' I get a response that says pynng is successfully installed. However I don't see it in pip list or pip list --user. This is my pip list image

wanghaEMQ commented 1 year ago

Plz also show yoursudo pip list

sohanpatil1 commented 1 year ago
image
wanghaEMQ commented 1 year ago

Do you want to import pynng to your project?

pip install -e . will install pynng in an editable mode (something like debug mode). If you want to install pynng to your ubuntu20.04 instance and import it to your project. pip install . should works. Then you can find it in pip list.

sohanpatil1 commented 1 year ago

Thanks! It worked, and I am able to use it as expected for Ubuntu20.04!