Git Product home page Git Product logo

Comments (5)

eppesuig avatar eppesuig commented on June 11, 2024 1

I just found the solution: the first listener seems to always be related to the mqtt protocol. My working configureation specifies two listeners this way:

listener 1883 192.168.222.54
protocol mqtt
listener 8883 192.168.222.54
protocol websockets

and now, it starts with these messages:

1706523693: mosquitto version 2.0.11 starting
1706523693: Config loaded from /etc/mosquitto/mosquitto.conf.
1706523693: Opening ipv4 listen socket on port 1883.
1706523693: Opening websockets listen socket on port 8883.
1706523693: mosquitto version 2.0.11 running

Thank you again for your help.

from android.

growse avatar growse commented on June 11, 2024

You appear to be trying to connect to a mosquito server with OT in HTTP mode?

HTTP mode is for talking to HTTP servers, like OT recorder. MQTT mode is for talking to MQTT brokers, like mosquitto.

from android.

eppesuig avatar eppesuig commented on June 11, 2024

Yes, you are right. I now corrected the connector to MQTT on the client and configured it for using websocket.
But I am still not able to connect to the server. The new exception is:

2024-01-29 10:36:14.670 I MQTTReconnectWorker: MQTTReconnectWorker started on threadID: Thread[androidx.work-3,5,main]
2024-01-29 10:36:14.838 E MessageProcessorEndpointMqtt: Failed to reconnect to MQTT broker
org.owntracks.android.services.MqttConnectionException:  (0) - java.io.IOException: WebSocket Response header: Invalid response from Server, It may not support WebSockets.
	at org.owntracks.android.services.MessageProcessorEndpointMqtt.connectToBroker(SourceFile:243)
	at org.owntracks.android.services.MessageProcessorEndpointMqtt.reconnect(SourceFile:46)
	at org.owntracks.android.services.MessageProcessorEndpointMqtt.lambda$reconnect$1(Unknown Source:0)
	at org.owntracks.android.services.MessageProcessorEndpointMqtt.$r8$lambda$3UR4gQL2b_UbF_ekJLIMhafolpU(Unknown Source:0)
	at org.owntracks.android.services.MessageProcessorEndpointMqtt$$ExternalSyntheticLambda0.run(Unknown Source:18)
	at android.os.Handler.handleCallback(Handler.java:938)
	at android.os.Handler.dispatchMessage(Handler.java:99)
	at android.os.Looper.loopOnce(Looper.java:233)
	at android.os.Looper.loop(Looper.java:344)
	at android.os.HandlerThread.run(HandlerThread.java:67)
Caused by:  (0) - java.io.IOException: WebSocket Response header: Invalid response from Server, It may not support WebSockets.
	at androidx.work.impl.utils.WorkForegroundUpdater$1.run(SourceFile:433)
	at java.lang.Thread.run(Thread.java:1012)
Caused by: java.io.IOException: WebSocket Response header: Invalid response from Server, It may not support WebSockets.
	at androidx.core.provider.FontRequest.execute(SourceFile:544)
	at org.eclipse.paho.client.mqttv3.internal.websocket.WebSocketSecureNetworkModule.start(SourceFile:26)
	at androidx.work.impl.utils.WorkForegroundUpdater$1.run(SourceFile:174)
	... 1 more

so, I double checked my server configuration and it is configured for websocket, but maybe it is running on a different port. The mosquitto log contents are:

1706521211: mosquitto version 2.0.11 starting
1706521211: Config loaded from /etc/mosquitto/mosquitto.conf.
1706521211: Opening ipv4 listen socket on port 8883.
1706521211: Opening websockets listen socket on port 1883.
1706521211: mosquitto version 2.0.11 running

in my configuration I heve these lines:

protocol websockets
listener 8883 192.168.222.54

interesting enough is that if I switch these lines, mosquitto does not start anymore. It gives error message:

1706521555: mosquitto version 2.0.11 starting
1706521555: Config loaded from /etc/mosquitto/mosquitto.conf.
1706521555: Opening websockets listen socket on port 8883.
1706521555: Error: Unable to start any listening sockets, exiting.

So, do the configuration lines require to be put in a specifi order in order to let MQTT use websocket on port 8883?

Thank you very much

from android.

jpmens avatar jpmens commented on June 11, 2024

The protocol line specifies the listener's protocol, and you define the order as you like.

from android.

eppesuig avatar eppesuig commented on June 11, 2024

Thank you. I am closing the issue.

from android.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.