Add mqtt websocket server settings in env file #299
This commit is contained in:
parent
d2286f21ff
commit
3667e122d0
2 changed files with 5 additions and 2 deletions
|
|
@ -4,3 +4,5 @@ twig:
|
||||||
strict_variables: '%kernel.debug%'
|
strict_variables: '%kernel.debug%'
|
||||||
globals:
|
globals:
|
||||||
gmaps_api_key: "%env(GMAPS_API_KEY)%"
|
gmaps_api_key: "%env(GMAPS_API_KEY)%"
|
||||||
|
mqtt_host: "%env(MQTT_WS_HOST)%"
|
||||||
|
mqtt_port: "%env(MQTT_WS_PORT)%"
|
||||||
|
|
|
||||||
|
|
@ -29,8 +29,8 @@ function initMap() {
|
||||||
// TODO: put this in .env
|
// TODO: put this in .env
|
||||||
var mqtt;
|
var mqtt;
|
||||||
var timeout = 2000;
|
var timeout = 2000;
|
||||||
var host = '192.168.56.4';
|
var host = '{{ mqtt_host }}';
|
||||||
var port = 8083;
|
var port = {{ mqtt_port }};
|
||||||
|
|
||||||
function onConnect() {
|
function onConnect() {
|
||||||
console.log('connected!');
|
console.log('connected!');
|
||||||
|
|
@ -90,6 +90,7 @@ function mqttConnect() {
|
||||||
|
|
||||||
mqtt = new Paho.MQTT.Client(host, port, client_id);
|
mqtt = new Paho.MQTT.Client(host, port, client_id);
|
||||||
var options = {
|
var options = {
|
||||||
|
useSSL: true,
|
||||||
timeout: 3,
|
timeout: 3,
|
||||||
onSuccess: onConnect,
|
onSuccess: onConnect,
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue