Skip to content

Instantly share code, notes, and snippets.

@mbafford
Created April 9, 2015 01:35
Show Gist options
  • Save mbafford/d8db8190d3d7101b7d54 to your computer and use it in GitHub Desktop.
Save mbafford/d8db8190d3d7101b7d54 to your computer and use it in GitHub Desktop.
owntracks: Invalid protocol "MQTT" in CONNECT

In case someone else is trying to search for this error and can't get it figured out.

In trying to set up Owntracks ( http://owntracks.org/ ) I was running into an error on connection.

The error logs from Mosquitto:

1428534995: New connection from 10.10.10.1 on port 8883.
1428534995: OpenSSL Error: error:140D9115:SSL routines:SSL_GET_PREV_SESSION:session id context uninitialized
1428534995: Socket read error on client (null), disconnecting.
1428535258: New connection from 10.10.10.1 on port 8883.
1428535258: Invalid protocol "MQTT" in CONNECT from 10.10.10.1.
1428535258: Socket read error on client (null), disconnecting.

The issue is due to the older version of mosquitto I was using due to an outdated Ubuntu install:

mosquitto version 1.2.3 (build date 2013-12-04 21:24:29+0000)
mosquitto is an MQTT v3.1 broker.
Usage: mosquitto [-c config_file] [-d] [-h] [-p port]

This issue is resolved with Mosquitto 1.4.x:

1428542271: mosquitto version 1.4.1 (build date 2015-04-03 07:41:26+0000) starting
1428542271: Config loaded from /etc/mosquitto/mosquitto.conf.
1428542271: Opening ipv4 listen socket on port 8883.
1428543249: New connection from 10.10.10.1 on port 8883.
1428543249: New client connected from 10.10.10.1 as dnt/foo (c0, k3600).
1428543249: Sending CONNACK to dnt/foo (0, 0)
1428543249: Received UNSUBSCRIBE from dnt/foo
1428543249: Received SUBSCRIBE from dnt/foo
1428543249: 	owntracks/dnt/barbaz (QoS 1)
1428543249: dnt/foo 1 owntracks/dnt/barbaz
1428543249: Sending SUBACK to dnt/foo
1428543249: Received PUBLISH from dnt/foo (d0, q1, r1, m3, 'owntracks/dnt/barbaz', ... (114 bytes))
1428543249: Sending PUBACK to dnt/foo (Mid: 3)
1428543249: Sending PUBLISH to dnt/foo (d0, q1, r0, m1, 'owntracks/dnt/barbaz', ... (114 bytes))
1428543249: Received PUBLISH from dnt/foo (d0, q1, r1, m4, 'owntracks/dnt/barbaz', ... (154 bytes))
1428543249: Sending PUBACK to dnt/foo (Mid: 4)
1428543249: Sending PUBLISH to dnt/foo (d0, q1, r0, m2, 'owntracks/dnt/barbaz', ... (154 bytes))
1428543249: Received PUBACK from dnt/foo (Mid: 1)
1428543249: Received PUBACK from dnt/foo (Mid: 2)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment