in reply to Re^8: Mojolicious refresh
in thread Mojolicious refresh

> the server does indeed push its updates to the client

Technically yes, that's the benefit of web sockets I listed.

But he said he's triggering it from the client via angular, which means requesting the update.

And in this case I'd like to know the benefits over a normal XMLHttpRequest.

Cheers Rolf
(addicted to the Perl Programming Language :)
Wikisyntax for the Monastery

Replies are listed 'Best First'.
Re^10: Mojolicious refresh
by jo37 (Curate) on Mar 19, 2020 at 10:19 UTC

    I'm not triggering an update from the client side. The client is listening on a web socket and waits for updates coming from the server.

    Greetings,
    -jo

    $gryYup$d0ylprbpriprrYpkJl2xyl~rzg??P~5lp2hyl0p$
      > I'm not triggering an update from the client side

      Maybe you should be clearer in your statements?

      You said:

      > > > > > where the page's content depends on some JS variables and is automatically refreshed whenever a variable's value changes.

      > The client is listening on a web socket and waits for updates coming from the server.

      Neither new nor "more advanced".

      I already listed this in my last point about web sockets.

      Cheers Rolf
      (addicted to the Perl Programming Language :)
      Wikisyntax for the Monastery

        Probably not the best idea to interject between two people talking past each other, but . . .

        Nothing in either of those sentences (as I'm reading it; and as I (basically) understand angularjs) implies (to me) that the client triggers anything. The flow of information (after the websocket connection back is established) for the purposes of display is all server => client.

        The client opens a ws connection back to the server and then sits and waits (passively, patiently) for events to come in on it. When a value changes on the server the server sends an event to the client side with the new value ("Hey you: foobniz is now 'vreemflitzle'!"). The client processes that event by updating its local cache of that value, updates anything in its virtual copy of the dom which is dependent on that value, and repaints anything in the real dom which has changed.

        The cake is a lie.
        The cake is a lie.
        The cake is a lie.

      A reply falls below the community's threshold of quality. You may see it by logging in.