net::ERR_NETWORK_CHANGED on Chrome on Https socket connection - javascript

I'm running a Server-sent Event (SSE) server over Ingress/Kubernetes/GoogleCloud and it works like a charm. I can run SSE clients over the web and they connect perfectly, start receiving events with no problem.
But there's one ugly bug I can't get it work right, on Chrome browsers after some time I get net::ERR_NETWORK_CHANGED error. No matter how many times I run it, I always get it after a few seconds/minutes.
If I run the same client over Firefox, nothing wrongs happens. If I run it using cURL over terminal, nothing wrong happens.
If I decide to run if over Chrome without HTTPS, it works! I'm only getting it when running it through HTTPS and on a Chrome browser.
Has anyone encountered this before? Seems like a ugly bug for me.

I'm having the same problem but it's sporadic.
From the Chromium project source code: OnNetworkChanged will be called when a change occurs to the host computer's hardware or software that affects the route network packets take to any network server. Some examples:
A network connection becoming available or going away. For example
plugging or unplugging an Ethernet cable, WiFi or cellular modem
connecting or disconnecting from a network, or a VPN tunnel being
established or taken down.
An active network connection's IP address changes.
A change to the local IP routing tables.
Hope it helps

For me using a mac system and chrome for a daily basis, I encounter this problem now and then and finally found it might be helpful to solve this problem by just turning off the virtual machines or dock containers whichever can adjust your network configuration.
Maybe not fit for your case but it could be a hint. I saw a lot of people having this kind of issue with chrome.

Related

Get Chromecast to run in a secure context when connected to local dev server

I have adopted a codebase for a Chromecast app for one of our major clients. This has been handed over to me because the original developer has recently left our company. Upon trying to do a handover, however, we were surprised to find that the Chromecast client (which is a simple JavaScript SPA) does not run when hosted by my machine! The content requires use of the navigator.requestMediaKeySystemAccess API for DRM-protected video, which is not available on my host, but is available on my ex-colleague's.
After much investigation, the root cause seems to the fact that the Chromecast does not deem my dev server's host (something like http://10.1.2.75:4301) a "secure context" - the navigator.requestMediaKeySystemAccess API is only available in such secure contexts. However, the old developer of this project has been connecting the Chromecast to their local dev server (something like http://10.1.2.89:4301) just fine for more than 2 years, he was completely surprised to find that it didn't work for anybody else. We ran numerous tests for different configurations, tried casting from different sources, connecting to different people's machines, etc. but whenever we inspected window.isSecureContext on his host it would return true - and on mine it would return false.
From my understanding, there should basically be no scenario where isSecureContext should be true on any kind of http connection, and yet this was very much the case on my ex-colleague's machine - and had been for a long period of time. If this hadn't been the case and this were a new project I was starting I would immediately say "we're going to need to develop this on some sort of HTTPS connection", and yet the evidence I have disproves this.
How can I get the Chromecast to trust my browser enough to expose this navigator.requestMediaKeySystemAccess API - it should be all I need to get this project working without some kind of local tunnel like ngrok (which is what I'm having to do at the moment, and it is causing all sorts of issues). In Chrome you can explicitly instruct a website to trust insecure content - is there a way that I can do this on the Chromecast device? Is there a way I can get it to trust a self-signed certificate or something?
Lastly, I can't realistically do much stuff at a network level like set up a private CA and provision certs to dev machines, etc, as we are a pretty small company with little-to-no in-house architecture (so that we needn't maintain anything). I also don't like the idea of telling future devs on this project that the way of running this project is "long list of shenanigans that only I understand".
Any help or advice on this would be much appreciated!
Update: I accidentally left my Chromecast pointing directly to my local dev server and managed to recreate the working scenario, which I took a screenshot of. I assume this won't last very long, so here's exactly what I'm talking about. This is possible:

Cordova hybrid app- HTTP requests are very slow

I am building a hybrid app, with AngularJS, Cordova, Restangular ond client side and Python with wsgiref.simple_server on server side. I am not doing anything special, this is very simply requests like this:
Restangular.one('/devices').get().then(function (response) {
viewModel.devices = Restangular.stripRestangular(response.devices);
});
I set baseUrl for Restangular:
.config(function(RestangularProvider){
RestangularProvider.setBaseUrl('http://192.168.54.102:8000/');
})
And when I use it on local computer with Chrome browser, everything is fast, works normal. But when I use it on Android on Phonegap developer app on device or install app on device with Android, it works crazy slow. It looks like it is send to server with big delay, cause it takes some time as I see debug server log on server side. It occurs also when python application with server is not in debug mode, for example when I start it normally after install on local computer. As I see some people has this problem, does anybody found a solution or a reason, which causes very slow HTTP requests in hybrid application? Thank you in advance for every answer.
Since you are a hybrid developer, I am sure you are familiar with the Chrome DevTools. For me on a Mac, hit cmd + option + i, or go to View -> Developer -> Developer Tools.
The really great thing about Chrome in recent history is it now works with Android WebViews too. Hybrid developers haven't always had this convenience, and had to debug essentially handcuffed using tools like Weinre.
Now we can use the DevTools directly in the Chrome browser while your Android device is connected by ADB from a new tab calling chrome://inspect
Here is some more detailed information on how to do this if you get stuck.
From here open up the network panel and see how long your requests are taking. If they are showing a significantly longer amount of time to load here, the issue has nothing to with Angular, Cordova, Restangular or probably even Hybrid architecture at all. I would check your network and performance elsewhere on the device.
If this is definitely not the issue, I would use the Timeline tab in the DevTools to see what is taking so long between your browser receiving the information and your device displaying it. If there is any significantly longer process taking place in between, you will see it here.

Configuring maximum number of simultaneous open WebSockets (in IE)

I've got this JS application. All client side JS communicating with a third party stream server via web sockets. I have about 18 different web sockets open for one page. Firefox and Chrome handle this many open web sockets at once just fine. IE11 seems to have a limitation of 4 open web sockets at once. Once I open that 5th web socket, regardless of socket call to the third-party server, I get an error thrown by IE, which closes the socket and gives the general error "SecurityError" and expanding the proto section it gives me . Seems to be pretty generic errors from my searches. At first I thought there may be a trusted zone type issue with IE, but I've added the client site to my trusted zone as well as the server providing the data.
This post provides info on max number of websockets for Firefox & Chrome, but I don't see anything specific about IE. Are there any known limitations to IE and web sockets? Answered, see edit below.
This MDN site talks about increasing the max value, but again, I can't find anything about IE. Is there some IE setting to up the amount of open connections? Answered: see below edit.
EDIT: This site shows the max connections settings for IE. It looks like it's a registry setting in Windows that controls the amount of web socket connections. Interestingly enough, I don't have that registry Key anywhere, but there is still a limit for this. The page speaks of IE10, and I'm working with IE11 specifically. Does anyone know if there are registry settings for this in regards to IE11? Has anyone just added these feature web socket registry keys and solved this issue?
The MSDN documentation you referenced is clear on the default being 6 concurrent connections (which means if not specified in the registry, that's what you'll get); and, if the documentation doesn't specify differently, it's probably safe to assume newer versions of Internet Explorer act in the same way as version 10.
Try setting through group policy. It worked for me.
https://jwebsocket.org/documentation/reference-guide/internet-explorer-tips

WebSocket: onMessage() only triggered at the end when server is closing connection

I have a weird error that I can not solve.
My implementation WebSocket works perfectly. The browser connects to the server, exchange their keys and the connection is fully established! The server starts sending messages to clients (visible in the network traffic).
But on my PC, all browsers (Chrome, Firefox, portable or not), the "onMessage ()" is correctly interpreted ... but only at the end when I turn off the server! In other words, if I put an alert () to each onMessage (), during exchange, I did absolutely nothing. But once I cut the server, I receive all alerts at once!
Yet on my MacBook everything works perfectly.
This ironic is it that behavior that affects all of my browsers on my PC. I run under Windows 7.
Thank you in advance ;)
I've finally found the issue !
If you have some troubles with Websockets, just disable the SSDP discover service on Windows.
net stop SSDPSRV
I ran into a similar issue recently. web server runs a separate SSDP discovery process to find uPnP devices on the network. When I had SSDP enabled, my websocket connection was always closed. Disabling SSDP solved it. But I haven't had a chance to investigate why.

Websockets message loss

When using websockets I noticed some message loss. I am trying to communicate between mobile safari (client) and c#(server). I am using superWebSocket (opensource) as a server, so it might be a server bug...
But the messages are only dropped when the connection is congested (When I send alot of messages). This "reaks" of UDP to me, but I remember reading somewhere that web-sockets are TCP.
Is there any occasion where I might issue a "send" command in javascript, and the receiving side does not get the message?
I've been using WebSockets extensively in with high traffic applications and in situations where a single lost message (in either direction) is fatal. I've never seen any messages lost, ever. However, I do recall seeing a post or question somewhere about the same issue and that person was also using superWebSocket for the server. So my strong suspicion is that there is a bug in superWebSocket.
Do you see the same problem if you use a non-mobile browser? It's possible the iOS brower (I assume that's what you mean by mobile Safari) has a WebSocket bug. I've not extensively tested that browser with WebSockets. I have extensively tested Chrome, Firefox (with WebSocket enabled), and Opera (with WebSocket enabled) on Linux and Windows and Safari on Windows.
There is no occasion where a send in Javascript is allowed to not reach the server except if the whole connection fails. If that is happening then there is a bug somewhere.

Categories

Resources