mirror of
https://bitbucket.org/FransoletThomas/tablet-app.git
synced 2025-12-06 00:21:19 +00:00
Fix MQTT connection if port number in host
This commit is contained in:
parent
a213e919c3
commit
e6e084a77d
@ -1,4 +1,5 @@
|
||||
import 'dart:convert';
|
||||
import 'dart:developer';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:fluttertoast/fluttertoast.dart';
|
||||
@ -107,7 +108,13 @@ class MQTTHelper {
|
||||
TabletAppContext tabletAppContext = appContext.getContext();
|
||||
|
||||
var identifier = await DeviceInfoHelper.getDeviceDetails();
|
||||
tabletAppContext.clientMQTT = MqttServerClient.withPort(tabletAppContext.host.replaceAll('http://', ''), 'tablet_app_'+identifier, 1883);
|
||||
var hostToTake = tabletAppContext.host;
|
||||
if(tabletAppContext.host.lastIndexOf(":") > 5)
|
||||
{
|
||||
hostToTake = tabletAppContext.host.substring(0,tabletAppContext.host.lastIndexOf(":"));
|
||||
}
|
||||
|
||||
tabletAppContext.clientMQTT = MqttServerClient.withPort(hostToTake.replaceAll('http://', ''), 'tablet_app_'+identifier, 1883);
|
||||
isInstantiated = true;
|
||||
|
||||
tabletAppContext.clientMQTT.logging(on: false);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user