[英]Paho MQTT in NativeScript
I'm trying to use the Poho MQTT library's JavaScript implementation ( http://eclipse.org/paho/clients/js ) in a NativeScript application. 我正在尝试在NativeScript应用程序中使用Poho MQTT库的JavaScript实现( http://eclipse.org/paho/clients/js )。
I referenced the file with require("./lib/mqttws31");
我用require("./lib/mqttws31");
引用了文件require("./lib/mqttws31");
and replaced all the window.timer
's with require("timer")
statements. 并将所有window.timer
替换为require("timer")
语句。 I also added require("nativescript-websockets");
我还添加了require("nativescript-websockets");
to the top of the mqttws31.js file after installing the module from github.com/NathanaelA/nativescript-websockets. 从github.com/NathanaelA/nativescript-websockets安装模块后,将其移至mqttws31.js文件的顶部。 I also commented out the bit of code referring to localstorage
. 我还注释了一些有关localstorage
的代码。
I'm getting the application to run, but it doesn't seem to do anything. 我正在运行该应用程序,但似乎没有任何作用。
您最好使用带有nativescript的webview webview界面在网页和nativescript之间进行双向控制,这更像是高级ionic或应该说Cordova应用
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.