• Ananace@lemmy.ananace.dev
    link
    fedilink
    English
    arrow-up
    4
    ·
    edit-2
    2 years ago

    Websockets really don’t integrate well with the entire rest of the HTTP stack, instead just repurposing the socket as a free-standing two-way communication pipe.

    You can definitely use websockets for requests like regular HTTP, but you have to reimplement things like cookies/session handling, request resumption/retry, duplicated request detection, request timeouts, authentication, etc yourself if you want to use it that way.

    I personally much prefer regular HTTP requests for queries/RPC, and HTTP SSE for notification streams, since those are well developed technologies in the web space - and work much better if there’s a middleware in between.