Why is it that when my wifi is interrupted and then comes back on, the webpage I’m on just stalls until being refreshed instead of coming back online?



Why is it that when my wifi is interrupted and then comes back on, the webpage I’m on just stalls until being refreshed instead of coming back online?

In: Technology

Because the developers of the webpage didn’t account for your connection going poof. This would be more or less a nonissue for older request-response style webpages that don’t maintain a connection when nothing is being sent, but nowadays everything wants realtime communication and uses websockets for that – which get dropped like it’s hot when the connection dies. Is it possible to reconnect and recover the session automatically? Sure is, but it’s extra work and needs a bit more than an intern to design.

Most web sites work on a “request/response” basis, so you ask for a thing, they send it to you… Then they wait until you ask for something else…

When you’re on a site like Facebook, or Twitter and it’s updating feeds in real time, this is usually done with a thing called web hook/web socket, which is a long lasting request where they can respond multiple times as new content is available.

I’m both cases, the request is sent from your computer over a connection that originated at your browser, and if it is interrupted, needs to be re-established. Some browsers are smart and they detect the interruption and reload for you, but not all, and not in every case.

Of course the web site knows of they had a web hook and it disappeared, but they can’t re-establish the connection, because the way our routers work, they wouldn’t let the connection through without a matching request from your PC going out through the router

When you are connected to a webpage, your computer phoned up another computer somewhere to get that webpage. That other computer is sitting around listening for other computers to call it, and it “serves” up the webpage in a response. That’s why we call them “servers”.

Say you fire off a request for a webpage to a server and then your Internet connection cuts out for a minute right after. Your request flies out, gets to the server, the server happily responds, and then the message bounces off of your router because you’re not connected when the reply arrives. At that point the data is simply thrown away.

The connection is re-established shortly and now we have a problem. The server thinks its job is done, because it sent the message just like it’s supposed to, but your computer is still thinking it’s supposed to be waiting for the reply, so it continues to wait for a reply that will never come.

Your browser will probably give up waiting after some amount of time of waiting, a pre-programmed “give up” threshold. Half a minute or so, maybe. That is its way to prevent itself from waiting forever. It probably won’t re-send the request automatically, though, because there are many, many situations where you don’t want to send a reply twice in a row automatically. What if you were buying something and you just clicked the “Buy Now” button? The server got your request, it’s been bought, but your computer didn’t see that the sale went through. if your browser automatically refreshed it for you, you might end up buying it again. That’s not good. So they usually don’t bother. They leave it up to you to decide if you want to try refreshing the page because they want you to stay in control of that kind of thing.

Imagine your computer and the server you are browsing to is like having a phone call. You call them (A Syn is generated), they answer hi ( a syn-ack from them), and you say hi back (an ack from you). A conversation is then carried out (data transmission). In a normal conversation where you hang up you say goodbye (Fin) and the server says goodbye (Fin-ack).

Now when your conversation gets interrupted, in TCP type connections, you have a window before your connection gets reset. As if you’re driving through a tunnel. In a short tunnel the server repeats until you hear it and you respond back. In a longer tunnel the server repeats until it gets angry at you and hangs up. Now once your internet is back up you have to call the server back and start that awkward hello bit before getting back to the conversation.

I don’t know, I just came here to say when I first started reading the question I saw “when my wife is interupted…”and I was getting prepared to read some fun answers