Discussion:
Odd Behavior with Websocket
(too old to reply)
john
2018-11-27 03:38:13 UTC
Permalink
Hello,

I have controller code that subscribes to Mojo::Pg::PubSub messages and
sends messages via Websocket based on that subscription.  However, It
appears to me that the Websocket on finish is getting hit when a
Mojo::PubSub messages comes in to listen handler.  Even then the
Websocket is not really closed. If I comment out the pubsub->unlisten
more messages come in and get delivered to the client.

Yeah, I am doing something wrong.   I have not distilled it down to a
simple scenario so it could be my problem originates outside this code.

The "output" sub is where I see this behavior:

https://github.com/john-/telem_control/blob/084347f18bdfd69ae6b32b20fc7013786ac23bce/lib/TelemControl/Controller/Main.pm#L21

Every time a message comes in the on finish for the Websocket is hit.  
Typical log pattern:

[2018-11-26 21:27:57.82505] [2976] [debug] WebSocket for details closed
in output handler(1006)
[2018-11-26 21:27:59.07773] [2955] [debug] item to let client know about
(pubsub): audio

This same pattern repeats for every message that comes in via pubsub.

Yes, there is probably more happening here than I am saying but that is
what I understand at the moment.

I am using Mojolicious-8.07 and Mojo-Pg-4.12.

Thanks,

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+***@googlegroups.com.
To post to this group, send email to ***@googlegroups.com.
Visit this group at https://groups.google.com/group/mojolicious.
For more options, visit https://groups.google.com/d/optout.
Continue reading on narkive:
Loading...