SIDN / spin

SPIN Core Software
https://spin.sidnlabs.nl
GNU General Public License v2.0
77 stars 9 forks source link

?mqtt_port= not handled as number #79

Closed ExploWare closed 3 years ago

ExploWare commented 3 years ago

https://github.com/SIDN/spin/blob/c6b7ec216997572d3190bf8815684a1b4c55cea5/src/spinweb/static/spin_graph/js/mqttws31.js#L1593

I have been thrown this error when manually adding ?mqt_port=2226 to my graph.html request:

Uncaught Error: AMQJS0012E Invalid type string for port.
    Client http://myhost:2225/spin_graph/js/mqttws31.js:1595
    connectToMQTT http://myhost:2225/spin_graph/js/mqtt_client.js:77
    init http://myhost:2225/spin_graph/js/mqtt_client.js:53

I have been able to resolve this by adding these to lines at 1573:

               if (typeof port !== "number") 
                    port = parseInt(port);

I have to do this type of defining the MQTT Websockets port as I don't have the ability to use 1883/1884 routed through the firewall because of an already existing MQTT server, and defining these ports in the config for spinweb does not overrule these static defines

cschutijser commented 3 years ago

I committed a different fix in https://github.com/SIDN/spin/commit/62b52958d9c44c66f4e566787bcd65db4b3f56b0, thanks again for reporting!