0
ionic2 Android 앱에서 WebSocket 작동을 시도합니다. 브라우저 모드에서 잘 작동합니다..ionic2 WebSocket이 Android 앱에서 작동하지 않습니다.
나는 https://github.com/knowledgecode/WebSocket-for-Android를 설치 한 다음 모든 지침 : - 코르도바 - 플러그인 - 화이트리스트 설치 - 콘텐츠 - 보안 - 정책 (CSP)를 설정 - 설정 config.xml에 :
<access origin="*"/>
<allow-intent href="ws://*/*:*"/>
<allow-intent href="wss://*/*:*"/>
그러나이
connect(){
this.ws = new WebSocket("ws://192.168.178.170:8000");
this.ws.onopen =() => {
console.log('open');
};
this.ws.onmessage = (event) => {
console.log('new message: ' + event.data);
this.messages.push(event.data);
};
this.ws.onerror =() => {
console.log('error occurred!');
};
this.ws.onclose = (event) => {
console.log('close code=' + event.code);
this.connect();
};
내가 뭔가를 놓친나요 난 안드로이드 이온 실행 내 서버에 어떤 연결을 테스트하지 않을 때?
가능한 [WebSocket이 Android 앱에서 작동하지 않음 (Phonegap Build 포함)] (http://stackoverflow.com/questions/38998548/websocket-not-working-on-my-android-app-with-phonegap) -짓다) – Blauharley