As I know, there is a solution for that (but I'm not sure): you can execute external commands from mysql when something happened, for example, send a message via some async messaging communication library and read it from your app and so on.

Better, ask for help in mysql community. (Or keep it simple and don't do what you described). Maybe if you'll provide a more "real world" example, someone will suggest you something less "abstract". But it's more complicated than just adding a few lines of code in your app.

> So is Mojo::IOLoop a viable solution to query the DB?
Mojo::IOLoop (and AnyEvent and others) is a solution for do something non blocking. a recurring method is a solution for do something every M.N seconds. But keep in mind that the most of mysql modules in Cpan are blocking. So you may want to take a look at MongoDB (via non-blocking perl driver https://metacpan.org/pod/Mango) if your expected requests can be heavy. Also there is async https://metacpan.org/release/AnyEvent-MySQL driver, but I have not been using it yet.


So is Mojo::IOLoop a viable solution to query the DB?
is there a better way than querying? something like push-message from DB to web-app?

Thanks

On Wednesday, June 18, 2014 7:19:35 PM UTC+3, alexbyk wrote:

    https://metacpan.org/pod/Mojo::IOLoop#recurring
    <https://metacpan.org/pod/Mojo::IOLoop#recurring>

    |# Perform operation every 5 seconds|
    |Mojo::IOLoop->recurring(||5| |=> ||sub| |{|
    |    ... do it here|
    |});|



    Hi,

    I have a mojo web-app that connects to a mysql DB and renders
    some data in the browser
    Now, I want to have something like push messages:
    - if I manually change some value in a table I want to make it
    visible in the browser without

    Basically I don't know how to query the DB in a cyclic way, maybe
    Mojo::IOLoop?
    and then after I get the data, how should I send it to the client
    - is it with websockets?
    Can somebody point me in the right direction?

    Thanks,
    Andrei
-- You received this message because you are subscribed to the
    Google Groups "Mojolicious" group.
    To unsubscribe from this group and stop receiving emails from it,
    send an email to [email protected] <javascript:>.
    To post to this group, send email to [email protected]
    <javascript:>.
    Visit this group at http://groups.google.com/group/mojolicious
    <http://groups.google.com/group/mojolicious>.
    For more options, visit https://groups.google.com/d/optout
    <https://groups.google.com/d/optout>.

--
You received this message because you are subscribed to the Google Groups "Mojolicious" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected] <mailto:[email protected]>. To post to this group, send email to [email protected] <mailto:[email protected]>.
Visit this group at http://groups.google.com/group/mojolicious.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups 
"Mojolicious" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/mojolicious.
For more options, visit https://groups.google.com/d/optout.

Reply via email to