• Margot Robbie@lemmy.worldOPM
    link
    fedilink
    English
    arrow-up
    3
    ·
    1 year ago

    Think of your computer and the servers on the internet two places connected by a highway. The method of getting something from one place to the other would be to ship it by truck.

    Now, the traditional method, HTTP, would be having a one lane highway, and having the truck drive from your computer to the server, and then have the same truck drive back on the same lane.

    But for WebSocket, when you just need the thing from the server as quickly as possible, you would have one lanes of a bunch of trucks going to the server, and one lane of a bunch of trucks coming back from the server, which means you’ll always be getting something back as you are send things out.

    But of course, WebSocket is more complex to coordinate, since there are a lot more trucks going back and forth, so it’s good for things that needs immediate updates like chat or stock trades, but for slower things like Lemmy, it could just be simpler to keep that one lane highway.

  • NekoKamiGuru@ttrpg.network
    link
    fedilink
    arrow-up
    3
    ·
    1 year ago

    Here is the simple napkin sized explanation.

    The WebSocket protocol is a bidirectional and stateful communications protocol , unlike normal HTTP which is unidirectional and stateless . This makes WebSocket well suited for web applications such as chat programs and online gaming.