{"id":12197,"date":"2019-08-08T15:53:31","date_gmt":"2019-08-08T13:53:31","guid":{"rendered":"https:\/\/pi3g.com\/?p=12197"},"modified":"2019-08-08T15:53:31","modified_gmt":"2019-08-08T13:53:31","slug":"paho-failure-to-subscribe","status":"publish","type":"post","link":"https:\/\/pi3g.com\/de\/paho-failure-to-subscribe\/","title":{"rendered":"Paho nicht abonnieren"},"content":{"rendered":"<h1>Problem<\/h1>\n<p>AMQJS0005E Interner Fehler. Fehlermeldung: Cannot read property 'show' of undefined<\/p>\n<p>Dieser Fehler wird sporadisch angezeigt, insbesondere wenn Sie die gesamte Seite mit der Umschalttaste neu laden. <\/p>\n<h1>L\u00f6sung<\/h1>\n<p>Ich habe ein Vue.js Plugin um \"Toast\" Nachrichten anzuzeigen (Vue.toasted). Ich benutze es derzeit f\u00fcr Debugging-Zwecke. <\/p>\n<p>Alles funktionierte zun\u00e4chst gut, wie mein Code ausgef\u00fchrt wurde, nachdem Vue initialisiert wurde und die ganze Seite geladen.<\/p>\n<p>Um das MQTT-Abonnement zu beschleunigen, habe ich Code eingef\u00fcgt, um das Abonnement fr\u00fcher zu starten. <\/p>\n<p>Hier bin ich auf diesen Fehler gesto\u00dfen. Wie geschrieben, schien es eine Race Condition zu sein, da es nicht konsistent war.<\/p>\n<p>Es stellte sich heraus, dass meine getoasteten Nachrichten, die ich zur Fehlersuche eingef\u00fcgt hatte, das Problem verursachten. <\/p>\n<blockquote>\n<p>Funktion info(msg){<br \/>&nbsp;&nbsp;&nbsp;&nbsp; console.log(msg);<br \/>&nbsp;&nbsp;&nbsp;&nbsp; \/*if (typeof Vue !== 'undefined') {<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Vue.toasted.show(msg, {<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Aktion : {<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; text : 'OK',<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; onClick : (e, toastObject) =&gt; {<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; toastObject.goAway(0);<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; });<br \/>&nbsp;&nbsp;&nbsp;&nbsp; } sonst {<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; console.log(\"... Vue noch nicht verf\u00fcgbar ...\");<br \/>&nbsp;&nbsp;&nbsp;&nbsp; }*\/&nbsp;&nbsp;&nbsp; <br \/>\n}<\/p>\n<p><\/p>\n<\/blockquote>\n<p>Wie Sie sehen, f\u00fchrte das Entfernen der Vue.toasted.show dazu, dass der Code gut funktionierte.<\/p>\n<p>Deshalb: Wenn PAHO Fehlermeldungen ausgibt, kann das mit einem anderen Code zusammenh\u00e4ngen, den Sie eingebaut haben, und nicht unbedingt mit dem internen Paho-Status. <\/p>\n<h1>Arbeitscode: <\/h1>\n<blockquote>\n<p>Funktion info(msg){<br \/>&nbsp;&nbsp;&nbsp;&nbsp; console.log(msg);<br \/>&nbsp;&nbsp;&nbsp;&nbsp; if (typeof Vue !== 'undefined' &amp;&amp; typeof Vue.toasted !== 'undefined') {<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Vue.toasted.show(msg, {<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Aktion : {<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; text : 'OK',<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; onClick : (e, toastObject) =&gt; {<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; toastObject.goAway(0);<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; });<br \/>&nbsp;&nbsp;&nbsp;&nbsp; } sonst {<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; console.log(\"... Vue noch nicht verf\u00fcgbar ...\");<br \/>&nbsp;&nbsp;&nbsp;&nbsp; }<br \/>\n}<\/p>\n<p><\/p>\n<\/blockquote>\n<p>Dieser Code funktioniert, da er auch \u00fcberpr\u00fcft, ob Vue.toasted initialisiert wurde. <\/p>","protected":false},"excerpt":{"rendered":"<p>Problem AMQJS0005E Interner Fehler. Fehlermeldung: Cannot read property 'show' of undefined Dieser Fehler wird sporadisch angezeigt, vor allem wenn man mit Shift-Reload die ganze Seite neu l\u00e4dt. L\u00f6sung Ich habe ein Vue.js Plugin um \"Toast\" Nachrichten anzuzeigen (Vue.toasted). Ich verwende es derzeit f\u00fcr Debugging-Zwecke. Alles funktionierte zun\u00e4chst gut, wie mein Code ausgef\u00fchrt wurde, nachdem Vue initialisiert wurde...<\/p>","protected":false},"author":830,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":"","_links_to":"","_links_to_target":""},"categories":[402,666],"tags":[674,600,675],"class_list":["post-12197","post","type-post","status-publish","format-standard","hentry","category-development","category-vue-js","tag-eclipse-paho","tag-javascript","tag-vue-js"],"_links":{"self":[{"href":"https:\/\/pi3g.com\/de\/wp-json\/wp\/v2\/posts\/12197","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/pi3g.com\/de\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/pi3g.com\/de\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/pi3g.com\/de\/wp-json\/wp\/v2\/users\/830"}],"replies":[{"embeddable":true,"href":"https:\/\/pi3g.com\/de\/wp-json\/wp\/v2\/comments?post=12197"}],"version-history":[{"count":1,"href":"https:\/\/pi3g.com\/de\/wp-json\/wp\/v2\/posts\/12197\/revisions"}],"predecessor-version":[{"id":12198,"href":"https:\/\/pi3g.com\/de\/wp-json\/wp\/v2\/posts\/12197\/revisions\/12198"}],"wp:attachment":[{"href":"https:\/\/pi3g.com\/de\/wp-json\/wp\/v2\/media?parent=12197"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/pi3g.com\/de\/wp-json\/wp\/v2\/categories?post=12197"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/pi3g.com\/de\/wp-json\/wp\/v2\/tags?post=12197"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}