ws://sockets.ny.stackexchange.com/ seems to cause all of the Stack Oveflow pages to take a while to "load" (by "load" I mean that the browser tab stays for a while like this: )

It takes approximately 1.4 minutes for it to fully load:

Here is my browser information:

Google Chrome   28.0.1500.72 (Official Build 211400) m
OS  Windows 
Blink   537.36 (@153022)
JavaScript  V8
Flash   11.8.800.97
User Agent  Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/28.0.1500.72 Safari/537.36

For all you who might say it has to do with my internet speed:

  • What proxy are you behind? This doesn't happen to me (GC/Win7). I do get 502s on a Vodafone network, however – John Dvorak Jul 18 '13 at 13:59
  • @JanDvorak I am behind my office's proxy although I have never had this issue before. – Naftali aka Neal Jul 18 '13 at 14:00

I'm 99% sure Web Sockets will always show "pending" in Chrome's web developer tools because the request never actually completes. The 101 Switching Protocol is what is actually driving the request.

If it's still requesting something, it probably isn't the websocket connection. (it's pending for me, and no loading animation)

  • 1
    Yes, but then why does the page "load" for about one and a half minutes? – Naftali aka Neal Jul 18 '13 at 14:03
  • 2
    @amanaPlanaCAnalPAnaMA You aren't using a 1200bd modem, are you? ;) – Andrew Barber Jul 18 '13 at 14:05
  • @amanaPlanaCAnalPAnaMA I'm going to guess something else is waiting to do something. Maybe an ajax call that fires at page load? It says pending for me in Chrome 28 and the request has completed. – Steven V Jul 18 '13 at 14:05
  • 7
    @AndrewBarber Nooo, I do not think so... – Naftali aka Neal Jul 18 '13 at 14:07
  • @amanaPlanaCAnalPAnaMA Yes... seems to be slightly faster than one of those! (and makes our 100Mb fiber here look slow!) – Andrew Barber Jul 18 '13 at 14:10
  • @AndrewBarber ^_^ – Naftali aka Neal Jul 18 '13 at 14:10
  • 5
    This is correct. – balpha Jul 19 '13 at 7:24
  • This is true. I recently faced this issue and doubted on sockets, but on other pages the reloading thing wasn't happening, but no other request as well was showing up. I got really confused and frustated. Then I checked in the code that for image src with incorrect path and onerror trigger for incorrect path was also incorrect, some how, it got stuck in loop and page kept reloading. Mind you, I also stopped my server, but didn't help as well, as soon as I commented img tag, the page loading stopped, and everything worked just fine. – Satys May 16 '18 at 8:49
  • Or may be you check you src attribute of your image tags, if they are unknown, they should be corrected. This is purely based on observation of what I encountered. – Satys May 16 '18 at 12:19

"Pending" is a valid state for WebSockets. You can see the TCP frames being sent and received using the Chrome tools.

enter image description here

  • I see the Data column here, is that the data sent by the server? – Aftab Naveed Jul 2 '17 at 22:53
  • @AftabNaveed Yes. – kontinuity Jul 9 '17 at 5:29

I called socket.close()

in my case I was just opening the connection and and based on the event which says done then I was closing it,


const someTimeConsumingFn = () => {
    const socket = io();

    socket.emit('start', {process : 'power on'});

    socket.on('getSomething', (data) => {
    //Once we are done with all processing the server will respond
    //with the done

  • 1
    This might be true in general but this doesn't answer the question as that asks if it is correct that the Stack Exchange server almost never calls done on their end, leaving the websocket from the browsers point of view in a pending (waiting for data frames if you wish) state. And as confirmed in a comment by balpha (one of SE developers) and my own experiences SE leaves websockets open until either their server gracefully shutsdown or I have a network issue between my box and their network. I have had Stack Exchange websockets running for weeks. There is no done in their design. – rene Apr 5 '18 at 7:03

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .