treecaptcha opened a new issue, #1610:
URL: https://github.com/apache/cordova-android/issues/1610
# Bug Report
## Problem
Websockets never connect or fail to connect
### What is expected to happen?
When a websocket is created it should connect or fail to connect and print
an error in the console.
### What does actually happen?
The websocket does neither
## Information
<!-- Include all relevant information that might help understand and
reproduce the problem -->
### Command or Code
<!-- What command or code is needed to reproduce the problem? -->
```js
console.log("(C) 2023");
function sendMSG(Event) {
Event.preventDefault()
if (websock == null || websock.readyState != 1){
console.log("patience is a virtue")
return;
}
const txt = document.getElementsByClassName('messagebox')[0].value;
websock.send("send;" + uuid + ";" + id + ";" + txt);
document.getElementsByClassName('messagebox')[0].value = "";
}
document.getElementsByClassName('textsubmit')[0].addEventListener('submit',sendMSG);
// socks are cool!
var websock = new WebSocket('ws://[redacted]:8443');
var id;
var uuid;
function autoGet(){
if (websock == null || websock.readyState != 1){
return;
}
websock.send("get;" + uuid + ";" + id);
}
websock.addEventListener('open', (event) => {
console.log("Connection open with ", websock.url);
websock.send("new");
websock.send("get;" + uuid + ";" + id);
setInterval(autoGet, 5000);
});
websock.addEventListener('message', (event) => {
console.log("Message: ", event.data);
const components = (event.data + "").split(";");
if (components[0] == "new"){
console.log("recived new login data");
uuid = components[1];
id = components[2];
}
if (components[0] == "send"){
console.log("GOT A UPDATE");
document.getElementsByClassName('text')[0].innerHTML =
components[1]
}
});
function awake(){
console.log("I'm still awake");
}
setInterval(awake, 5000);
console.log(websock);
console.log("done with main.js");
```
No error is logged and "I'm still awake" is printed every 5 seconds
### Environment, Platform, Device
<!-- In what environment, on what platform or on which device are you
experiencing the issue? -->
Android Studio Emulator Pixel 3 API 33
### Version information
<!--
What are relevant versions you are using?
For example:
Cordova: Cordova CLI, Cordova Platforms, Cordova Plugins
Other Frameworks: Ionic Framework and CLI version
Operating System, Android Studio, Xcode etc.
-->
Cordova 11.1.0
Cordova Android 10.1.2
## Checklist
<!-- Please check the boxes by putting an x in the [ ] like so: [x] -->
- [x] I searched for existing GitHub issues
- [x] I updated all Cordova tooling to most recent version
- [x] I included all the necessary information above
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]