角度websocket插件正在浏览器中工作。但在移动设备生成apk之后,它不能正常工作,它显示错误。科尔多瓦websocket插件也无法正常工作,它显示错误代码1006.任何人都可以帮助我。我是新来的离子。cordova websocket插件显示错误代码1006和角度websocket插件显示isTrusted true错误
document.addEventListener('deviceready', function() {
var ws = new WebSocket('ws://197.164.1.12:8080/example/2');
ws.onopen = function() {
alert('open');
this.send('hello');
};
ws.onmessage = function (event) {
alert(event.data);
this.close();
};
ws.onerror = function (event) {
alert('error occurred!'+JSON.stringify(event));
};
ws.onclose = function (event) {
alert('onclose code=' + event.code);
};
ws.close = function (event) {
alert('close code=' + JSON.stringify(event));
alert('onclose code=' + event.code);
};
}, false);
你可以发布错误内容 –