I don't get why you put that code inside delay().

I would suggest moving it out of delay and right into the websocket sub.

What are you trying to accomplish by putting it inside delay()?


On Friday, April 29, 2016 at 3:20:29 PM UTC+2, Matija Papec wrote:
>
>
> When I set websocket events inside $c->delay() browser disconnects almost 
> immediately ("finish" event is properly triggered).
> Please explain what is wrong here.
>
> ======================
> use Mojolicious::Lite;
>
> websocket '/ws/:sessid' => sub {
>     my ($c) = @_;
>
> $c->delay(sub{
> $c->on(finish => sub { warn "disconnect\n" });
> $c->on(json => sub { warn "incoming ws json \n" });
> });
> };
>
>
>

-- 
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.
For more options, visit https://groups.google.com/d/optout.

Reply via email to