r/programming • • Jun 13 '19

WebSockets vs Long Polling

https://www.ably.io/blog/websockets-vs-long-polling/
581 Upvotes

199 comments sorted by

View all comments

425

u/[deleted] Jun 13 '19

[removed] — view removed comment

274

u/sysop073 Jun 13 '19

Go figure, since they were basically invented to eliminate the need for polling

60

u/hashtagframework Jun 13 '19

Go figure, my web host doesn't support WebSockets in the auto-scale configuration I use, but Long Polling still works fine.

-3

u/duheee Jun 13 '19

What does a web host have to do with web sockets? They run your app, your app can accept or not websocket upgrade requests, from JS that is being run by a web browser.

I don't quite see where the host appears in this equation.

4

u/bausscode Jun 13 '19

A socket is two way. There is a client and a server. If the server doesn't handle the websocket requests then the server does not support it regardless of whether the client does.

-2

u/duheee Jun 13 '19

right. the server is the app in this instance. the app needs to handle the websocket upgrade request, nobody else. that's my question: where does the host enter in this equation? they are only running the app.

6

u/Ravavyr Jun 13 '19

The host owns the server and on shared hosts you often don't have access to configure sockets to work on it. That's why the host matters.

-7

u/duheee Jun 13 '19

you don't configure sockets. sigh ... jesus.

0

u/Ravavyr Jun 13 '19

let me rephrase. Eg in node if you want to listen on a certain port you set it right?
What if the host has that port blocked? OR just blocks all ports except for 80 and 443 for example.
I guess that's what i meant by "configure".

3

u/duheee Jun 13 '19

That's not how websockets work. Not at all.

→ More replies (0)