MQTT Core, works in the editor but not in an Android (Meta Quest 3) Build.

I’m attempting to use MQTT Core in a VR project for Meta Quest 3. I can get it working in the Editor but as soon as i build it to the headset i get errors when trying to establish a connection with the MQTT server - mosquitto. I believe i have established it is not due to settings or firewall. Here is what i have checked:

  • Android permissions added to allow
    • android.permission.INTERNET
    • android.permission.ACCESS_NETWORK_STATE
    • android.permission.WAKE_LOCK
  • Checked - Using an http request from the headset - that the headset can reach the mosquitto mqtt server on port 1883. So the headset is able to make requests and the port is not blocked to TCP. Mosquitto registers a connection attempt with incorrect protocol.

When MQTTCore tries to connect it produces the following output and error in the log when running it on the device (Still tethered to the editor for logs)

LogMQTTCore: VeryVerbose: Created MQTTConnection for 192.168.1.19
LogMQTTCore: Display: Created new Client, Num: 1
LogMQTTCore: Verbose: Set State to: Connecting
LogMQTTCore: Verbose: Copy outgoing operations to buffer
LogMQTTCore: Verbose: Operations deferred: 1
LogMQTTCore: Error: Error sending MQTT packet: 192.168.1.19:1883: SE_ECONNRESET
LogMQTTCore: Error: Packet size mismatch: expected 46, was -1

LogMQTTCore: Verbose: Copy outgoing operations to buffer
LogMQTTCore: Verbose: Operations deferred: 1

The last two Verbose logs are repeated over and over.

The error seems to be internal to the plugin as I don’t know what Packet data was sent. The only settable fields are the BrokerUrl structure values that are fed into the Create Client (From URL) Function.

Kind of Ripping my hair out on this one, would be really great to have it working. So any suggestions please throw them at me.

Ok So after a bit more trying i gave up and bought this plugin - DT MQTT - From FAB. Which works out of the box for Meta Quest. Hope this helps someone else.