cancel
Showing results for 
Search instead for 
Did you mean: 
SOLVED

How to use Paho-MQTT with local javascript on WebIQ

How to use Paho-MQTT with local javascript on WebIQ

MaciejGroszyk
Member

Hello,

I am trying to connect to external broker mosquitto running local on my computer using lib-mqtt-paho libray or local javascript on WebIQ. It works fine from WebIQ Designer by Open preview level, but when I run project from Open Browser Preview or WebIQ Runtime  I got error: "paho-mqtt.js:1046 WebSocket connection to 'wss://192.168.1.103:8090/' failed" and paho onFailure errorCode return 7. 

mosquitto.conf 

listener 8090

protocol websockets

socket_domain ipv4
require_certificate true
use_identity_as_username true
cafile path_to_crt_file
keyfile path_to_server_key_file
certfile some_path_to_crt_file
tls_version tlsv1.2
 
and I can connect to broker via MQTT Explorer.

 

How can I upload certificates file to paho.MQTT.Client (lib-mqtt-paho)?

How can I upload certificates to WebIQ Runtime? I have tried uploading via WebDAV, but there is no WebIQ Runtime folder. Will it be enough to configure WebIQ Runtime listen port with certificates enough to connect to broker?

 

1 REPLY 1

webiq-sk
Frequent Contributor

1. When using the Paho MQTT example WebIQ is not connected to MQTT, rather only your browser is connected to MQTT. If you want to use MQTT with WebIQ, you can use the MQTT-to-OPC-UA server that you can download in the customer area for free.

2. All questions regarding Paho MQTT can be addressed at e.g. StackOverflow: https://stackoverflow.com/questions/tagged/paho as this is an open-source project.

3. You can upload TLS certificates and configure them using the Runtime Manager: http://<CORE IP>:10123, however :

4. As mentioned in 1. the certificate issue when using Paho in the browser is between your MQTT broker and your browser with WebIQ not involved. So the question would probably rather be "How can I setup TLS certificates on my MQTT broker?"

Icon--AD-black-48x48Icon--address-consumer-data-black-48x48Icon--appointment-black-48x48Icon--back-left-black-48x48Icon--calendar-black-48x48Icon--center-alignedIcon--Checkbox-checkIcon--clock-black-48x48Icon--close-black-48x48Icon--compare-black-48x48Icon--confirmation-black-48x48Icon--dealer-details-black-48x48Icon--delete-black-48x48Icon--delivery-black-48x48Icon--down-black-48x48Icon--download-black-48x48Ic-OverlayAlertIcon--externallink-black-48x48Icon-Filledforward-right_adjustedIcon--grid-view-black-48x48IC_gd_Check-Circle170821_Icons_Community170823_Bosch_Icons170823_Bosch_Icons170821_Icons_CommunityIC-logout170821_Icons_Community170825_Bosch_Icons170821_Icons_CommunityIC-shopping-cart2170821_Icons_CommunityIC-upIC_UserIcon--imageIcon--info-i-black-48x48Icon--left-alignedIcon--Less-minimize-black-48x48Icon-FilledIcon--List-Check-grennIcon--List-Check-blackIcon--List-Cross-blackIcon--list-view-mobile-black-48x48Icon--list-view-black-48x48Icon--More-Maximize-black-48x48Icon--my-product-black-48x48Icon--newsletter-black-48x48Icon--payment-black-48x48Icon--print-black-48x48Icon--promotion-black-48x48Icon--registration-black-48x48Icon--Reset-black-48x48Icon--right-alignedshare-circle1Icon--share-black-48x48Icon--shopping-bag-black-48x48Icon-shopping-cartIcon--start-play-black-48x48Icon--store-locator-black-48x48Ic-OverlayAlertIcon--summary-black-48x48tumblrIcon-FilledvineIc-OverlayAlertwhishlist