Did WebSockets Ever Rely Completely on HTTP?

0
3
Asked By CuriousCoder123 On

I'm curious if there was ever a time when WebSockets were fully dependent on HTTP for communication, not just during the initial handshake? I've heard from some colleagues that there were security restrictions that kept browsers from exposing TCP socket APIs, which might explain this. I remember reading about this in various resources, but I can't find anything on it now. Am I just imagining this, or was there an actual period when WebSockets operated this way?

4 Answers

Answered By TechieTom23 On

Some libraries like Socket.IO do fall back to HTTP long polling if the browser or device doesn't support WebSockets. That might be what's confusing you. It's not that WebSockets themselves relied on HTTP completely, though.

CuriousCoder123 -

Thanks for the input! I chatted with someone else about this and found out that Socket.IO existed before RFC 6455, so I might have mixed things up back then.

Answered By WebWizard88 On

Most WebSocket libraries fall back on HTTP if WebSockets aren't viable, using polling for that. As far as I know, the original WebSockets use HTTP to set things up, and that's been consistent.

CuriousCoder123 -

Thanks for clarifying! As mentioned earlier, I might have confused actual WebSocket implementations with early Socket.IO versions.

Answered By NetworkingNerd34 On

There are quite a few methods to keep an HTTP connection open without necessarily using WebSockets or SSE (Server-Sent Events). Maybe that's what you were recalling?

CuriousCoder123 -

Yeah, other users pointed out that I was mixing up real WebSocket implementations with some early Socket.IO work. Appreciate your help!

Answered By DevDude42 On

Nope, aside from the handshake, WebSockets operate differently. Developers did try to create socket-like interactions using HTTP in the past, especially with long polling. For more details, check out RFC 6455.

CuriousCoder123 -

Got it. Do you remember if Socket.IO was around before the full adoption of RFC 6455? I might be mixing up real WebSocket tech with some early implementation I saw.

JSNinja11 -

Ah, those were interesting times! I was writing similar code in the early 2000s—emulating data sending with flushes via iframes.

Related Questions

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.