Author Topic: Mosquitto on Rasberry Pi reporting "Invalid protocol "MQTT" in CONNECT  (Read 1402 times)

tonyw

  • Newbie
  • *
  • Posts: 4
    • View Profile
Im running mosquitto broker on a raspberry pi (version below). The mc-Gateway is trying to connect but in Pi logs Im seeing: Invalid protocol "MQTT" in CONNECT from 192.168.208.134  (this IP is the mc-gateway as expected).

Taking a snoop I can see that mc-gateway is using MQTT Protocol version=4

MQ Telemetry Transport Protocol
    Connect Command
        0001 0000 = Header Flags: 0x10 (Connect Command)
            0001 .... = Message Type: Connect Command (1)
            .... 0... = DUP Flag: Not set
            .... .00. = QOS Level: Fire and Forget (0)
            .... ...0 = Retain: Not set
        Msg Len: 24
        Protocol Name: MQTT
        Version: 4
        1100 0010 = Connect Flags: 0xc2
            1... .... = User Name Flag: Set
            .1.. .... = Password Flag: Set
            ..0. .... = Will Retain: Not set
            ...0 0... = QOS Level: Fire and Forget (0)
            .... .0.. = Will Flag: Not set
            .... ..1. = Clean Session Flag: Set
            .... ...0 = (Reserved): Not set
        Keep Alive: 20
        Client ID: 00010F69
        User Name:
        Password:

I think the client on my Pi can only use version 3. Is there a way to change it on the mc-gateway to version 3 ?

Mosquitto broker on Pi:
apt-cache search mosquitto
libmosquitto0 - MQTT version 3.1 client library
libmosquitto0-dev - MQTT version 3.1 client library, development files
libmosquittopp0 - MQTT version 3.1 client C++ library
libmosquittopp0-dev - MQTT version 3.1 client C++ library, development files
mosquitto - MQTT version 3.1 compatible message broker
mosquitto-clients - Mosquitto command line MQTT clients
python-mosquitto - MQTT version 3.1 client library, python bindings


thanks, Tony

Share on Facebook Share on Twitter


plains203

  • Newbie
  • *
  • Posts: 48
    • View Profile
I am using Mosquitto 3.1 as well with the latest firmware for every mcThing and it is working correctly.
It could be a firmware issue as there were more MQTT issues in lower versions. I see you are using a username and password for your broker, which I also am.

Edit
Also the Mosquitto version number is not the same as the MQTT Protocol version that Mosquitto supports. I am not sure what version it does however.
McGateway 0.6-360, 0.7-405
McModules 0.7-358
McStudio 0.7-894

mc-Abe

  • Full Member
  • ***
  • Posts: 167
    • View Profile
    • mc-Things
It looks like the raspberry pi version of the mosquitto broker only supports MQTT 3.1 (3) whereas the gateway uses MQTT 3.1.1 (4). Could you update your MQTT broker on the raspberry pi to the latest version and try again.

I believe this link will provide you the instructions for upgrading your broker on the pi: http://mosquitto.org/2013/01/mosquitto-debian-repository/

tonyw

  • Newbie
  • *
  • Posts: 4
    • View Profile
Thanks, sure enough I have now installed MQTT 3.1.1 (I followed this pretty much: ) and I can receive and send from the mc-module without problem.

Just trying to work out beaconing now.

kristofferis

  • Sr. Member
  • ****
  • Posts: 287
  • Location: Sweden
    • View Profile
That's good, what problem do you have with the beacon from the mcModules?