Im new working with phonegap. I have been trying for days to implement this pluging, in my phonegap app. Cordova version: 4.1.2, in android minor to 4.4.2, its just open the conection, but I don't receive the Onmessage.
Its work excellent in:
my HTC ONE X - android 4.4.4
Samsung Galaxy S5 - android 4.4.2
HTC Inspire - android 4.4.1
function onDeviceReady() {
var ws = new WebSocket('ws://echo.websocket.org');
ws.onopen = function () {
alert('open');
this.send('hello'); // transmit "hello" after connecting
};
ws.onmessage = function (event) {
alert(event.data); // will be "hello"
this.close();
};
ws.onerror = function () {
alert('error occurred!');
};
ws.onclose = function (event) {
alert('close code=' + event.code);
};
}
and here is the installed pluging and the access origin.
<gap:plugin name="nl.x-services.plugins.toast" />
<gap:plugin name="org.apache.cordova.network-information" />
<gap:plugin name="org.apache.cordova.dialogs" version="0.2.6" />
<gap:plugin name="org.apache.cordova.vibration" version="0.3.0" />
<gap:plugin name="com.simonmacdonald.telephonenumber" version="1.0.0" />
<gap:plugin name="com.ququplay.websocket.websocket" version="0.1.0" />
<!--
Define access to external domains.
<access /> - a blank access tag denies access to all external resources.
<access origin="*" /> - a wildcard access tag allows access to all external resource.
Otherwise, you can specify specific domains:
-->
<access origin="*"/> <!-- allow local pages -->
<!--
<access origin="http://phonegap.com" /> - allow any secure requests to http://phonegap.com/
<access origin="http://phonegap.com" subdomains="true" /> - same as above, but including subdomains, such as http://build.phonegap.com/
<access origin="http://phonegap.com" browserOnly="true" /> - only allows http://phonegap.com to be opened by the child browser.
-->
I think I've read every post on this topic and nothing.
I will be grateful for any help o suggestion . And sorry for my english. if you need more information just ask.
Hello
Im new working with phonegap. I have been trying for days to implement this pluging, in my phonegap app. Cordova version: 4.1.2, in android minor to 4.4.2, its just open the conection, but I don't receive the Onmessage.
Its work excellent in: my HTC ONE X - android 4.4.4 Samsung Galaxy S5 - android 4.4.2 HTC Inspire - android 4.4.1
even in emulators with the same operating system.
I build my apk using https://build.phonegap.com/apps.
This is the code that Im using in the conection test, just something basic.
document.addEventListener("deviceready", onDeviceReady, false);
function onDeviceReady() { var ws = new WebSocket('ws://echo.websocket.org');
}
and here is the installed pluging and the access origin.
I think I've read every post on this topic and nothing.
I will be grateful for any help o suggestion . And sorry for my english. if you need more information just ask.