简体   繁体   中英

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.

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

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,该项目在我写的时候工作正常,但需要在设备准备就绪后启动。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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