diff --git a/fhem/FHEM/00_MQTT2_CLIENT.pm b/fhem/FHEM/00_MQTT2_CLIENT.pm
index 21cc28ae0..00532ce5b 100644
--- a/fhem/FHEM/00_MQTT2_CLIENT.pm
+++ b/fhem/FHEM/00_MQTT2_CLIENT.pm
@@ -43,6 +43,7 @@ MQTT2_CLIENT_Initialize($)
disable:1,0
disabledForIntervals
disconnectAfter
+ httpHeader
ignoreRegexp
lwt
lwtRetain
@@ -107,6 +108,10 @@ MQTT2_CLIENT_connect($)
$hash->{connecting} = 1 if($disco && !$hash->{connecting});
$hash->{nextOpenDelay} = 5;
$hash->{BUF}="";
+ if($hash->{DeviceName} =~ m/^wss?:/) {
+ $hash->{binary} = 1;
+ $hash->{header}{"Sec-WebSocket-Protocol"} = "mqtt";
+ }
return DevIo_OpenDev($hash, $disco, "MQTT2_CLIENT_doinit", sub(){})
if($hash->{connecting});
}
@@ -314,6 +319,14 @@ MQTT2_CLIENT_Attr(@)
}
}
+ if($attrName eq "httpHeader") {
+ $hash->{header} = {};
+ for my $kv (split(" ",$param[0])) {
+ my ($k, $v) = split(":", $kv, 2);
+ $hash->{header}{$k} = $v;
+ }
+ }
+
my %h = (clientId=>1,lwt=>1,lwtRetain=>1,subscriptions=>1,SSL=>1,username=>1);
if($init_done && $h{$attrName}) {
delete($hash->{authError});
@@ -874,6 +887,13 @@ MQTT2_CLIENT_feedTheList($$$)
inactivity, and will be automatically reopened when sending a command.
+
+