简体   繁体   English

phonegap websocket不起作用

[英]phonegap websocket doesn't work

Ok i have tried in every way to put the phonegap-websocket plugin in my phonegap project and there's no way it could work. 好的,我已经尝试了各种方法将phonegap-websocket插件放入我的phonegap项目中,但无法正常工作。

I had install the plugin like it is explained in that page here , it seems the plugin is correctly installed, if i launch the cordova plugin list it appears, i have added the plugin in the config.xml too, i have added the src to the cordova_plugin.js and to the cordova.js file in the index.html, i have build the app and add a simple a script in the index.html 我有安装插件就像是在页解释在这里 ,似乎该插件安装正确,如果我启动科尔多瓦插件列表它的出现,我已经添加在config.xml插件也一样,我已经添加了对SRC cordova_plugin.js以及index.html中的cordova.js文件,我已经构建了应用程序,并在index.html中添加了一个简单的脚本

JS JS

var ws=new WebSocket("ws://echo.websocket.org");
ws.onopen=function(){
    alert('open')
    ws.send('hi')
}

ws.onmessage=function(){
    alert('hello')
}

if i put alerts before,between or after the two methods the cellphone where i test the app, appears, but the ones inside the methods not, like they didn't work, if anyone know why i really appreciate the explanation. 如果我在这两种方法之前,之间或之后发出警报,则我在其中测试应用程序的手机会出现,但如果有人知道为什么我真的很喜欢这种解释,则方法中的那些不会起作用,就像它们无法正常工作一样。

我会写答案,但优点必须归功于Dawson London,该项目在我写的时候工作正常,但需要在设备准备就绪后启动。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM