I want to read from redis in non-blocking way and delay() looks like first
choice for this kind of task (event callbacks are closures to session
related variables).
Alternatively I'll have to postpone redis access, and avoid delay() when
establishing websocket connection.
regards
On Monday, May 2, 2016 at 3:13:49 PM UTC+2, Jan Henning Thorsen wrote:
>
> 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 [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/mojolicious.
For more options, visit https://groups.google.com/d/optout.