Code that does the notification:
https://github.com/john-/telem_control/blob/d192bd24eef370868944830f3d54ace9ca3ed081/lib/TelemControl/Model/Sensors/GPS.pm#L48
That notify is similar on what is in the base class:
https://github.com/john-/telem_control/blob/d192bd24eef370868944830f3d54ace9ca3ed081/lib/TelemControl/Model/Sensors/Base.pm#L185
Model code that attempts to receive the pubsub messages:
https://github.com/john-/telem_control/blob/d192bd24eef370868944830f3d54ace9ca3ed081/lib/TelemControl/Model/Sensors/Weather.pm#L22
Thanks,
John
On 5/27/19 10:44 PM, Veesh Goldman wrote:
Can't really tell, because you aren't showing enough code, so I would
ask this: could you show the code that you're notifying the channel from?
On Tue, May 28, 2019, 12:07 AM John <j...@tonebridge.com
<mailto:j...@tonebridge.com>> wrote:
Hello,
From my model I want to listen for Pg PubSub messages. I am passing
the helper "pg" into the model as a param after creating it:
$self->helper( pg => sub { state $pg = Mojo::Pg->new(
$config->{pg}
) } );
How do I listen for messages? This compiles but doesn't do
anything as
far as I can see:
$self->pg->pubsub->listen(location_msg => sub {
my ($pubsub, $payload) = @_;
$self->log->debug('location: ' . Dumper($payload));
});
Do I need to create a Mojo loop of some sort in my model?
John
--
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 mojolicious+unsubscr...@googlegroups.com
<mailto:mojolicious%2bunsubscr...@googlegroups.com>.
To post to this group, send email to mojolicious@googlegroups.com
<mailto:mojolicious@googlegroups.com>.
Visit this group at https://groups.google.com/group/mojolicious.
To view this discussion on the web visit
https://groups.google.com/d/msgid/mojolicious/79407916-57d2-7233-3fe0-7cfbd3477c2c%40tonebridge.com.
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 mojolicious+unsubscr...@googlegroups.com
<mailto:mojolicious+unsubscr...@googlegroups.com>.
To post to this group, send email to mojolicious@googlegroups.com
<mailto:mojolicious@googlegroups.com>.
Visit this group at https://groups.google.com/group/mojolicious.
To view this discussion on the web visit
https://groups.google.com/d/msgid/mojolicious/CAO-W_8DDh%2BDWAB%2BBWdPNqvc_UbMxHHVR6SJmetzWErHcixKvbg%40mail.gmail.com
<https://groups.google.com/d/msgid/mojolicious/CAO-W_8DDh%2BDWAB%2BBWdPNqvc_UbMxHHVR6SJmetzWErHcixKvbg%40mail.gmail.com?utm_medium=email&utm_source=footer>.
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 mojolicious+unsubscr...@googlegroups.com.
To post to this group, send email to mojolicious@googlegroups.com.
Visit this group at https://groups.google.com/group/mojolicious.
To view this discussion on the web visit
https://groups.google.com/d/msgid/mojolicious/193e5c7c-196b-88f9-6943-91fc95c6cb62%40tonebridge.com.
For more options, visit https://groups.google.com/d/optout.